summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--Command/Add.hs16
-rw-r--r--doc/git-annex-add.mdwn5
-rw-r--r--doc/todo/annex_add___40__-u__124__--update__41___mode.mdwn2
-rw-r--r--doc/todo/annex_add___40__-u__124__--update__41___mode/comment_1_bde2b1e2c45e110d56ce98b43dd77743._comment7
5 files changed, 28 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c53b01c52..d988a969e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@ git-annex (6.20170322) UNRELEASED; urgency=medium
ignored, a reversion introduced in 6.20160527.
* gcrypt: Support re-enabling to change eg, encryption parameters.
This was never supported before.
+ * git annex add -u now supported, analagous to git add -u
-- Joey Hess <id@joeyh.name> Wed, 29 Mar 2017 12:41:46 -0400
diff --git a/Command/Add.hs b/Command/Add.hs
index f9cfbb9a1..beea48e0b 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010, 2013 Joey Hess <id@joeyh.name>
+ - Copyright 2010-2017 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -30,6 +30,7 @@ data AddOptions = AddOptions
{ addThese :: CmdParams
, includeDotFiles :: Bool
, batchOption :: BatchMode
+ , updateOnly :: Bool
}
optParser :: CmdParamsDesc -> Parser AddOptions
@@ -40,6 +41,11 @@ optParser desc = AddOptions
<> help "don't skip dotfiles"
)
<*> parseBatchOption
+ <*> switch
+ ( long "update"
+ <> short 'u'
+ <> help "only update tracked files"
+ )
seek :: AddOptions -> CommandSeek
seek o = allowConcurrentOutput $ do
@@ -52,10 +58,14 @@ seek o = allowConcurrentOutput $ do
)
)
case batchOption o of
- Batch -> batchFiles gofile
+ Batch
+ | updateOnly o ->
+ giveup "--update --batch is not supported"
+ | otherwise -> batchFiles gofile
NoBatch -> do
let go a = a gofile (addThese o)
- go (withFilesNotInGit (not $ includeDotFiles o))
+ unless (updateOnly o) $
+ go (withFilesNotInGit (not $ includeDotFiles o))
go withFilesMaybeModified
unlessM (versionSupportsUnlockedPointers <||> isDirect) $
go withFilesOldUnlocked
diff --git a/doc/git-annex-add.mdwn b/doc/git-annex-add.mdwn
index 15bb8a6a0..2ebbbac06 100644
--- a/doc/git-annex-add.mdwn
+++ b/doc/git-annex-add.mdwn
@@ -56,6 +56,11 @@ annexed content, and other symlinks.
Adds multiple files in parallel. This may be faster.
For example: `-J4`
+* `--update` `-u`
+
+ Like `git add --update`, this does not add new files, but any updates
+ to tracked files will be added to the index.
+
* `--json`
Enable JSON output. This is intended to be parsed by programs that use
diff --git a/doc/todo/annex_add___40__-u__124__--update__41___mode.mdwn b/doc/todo/annex_add___40__-u__124__--update__41___mode.mdwn
index 833117652..ab0eac108 100644
--- a/doc/todo/annex_add___40__-u__124__--update__41___mode.mdwn
+++ b/doc/todo/annex_add___40__-u__124__--update__41___mode.mdwn
@@ -1,3 +1,5 @@
to supplement 'git add -u' behavior -- to add only updated (tracked only, no untracked) files to be committed. ATM all files would be added, including untracked.
[[!meta author=yoh]]
+
+> [[done]]
diff --git a/doc/todo/annex_add___40__-u__124__--update__41___mode/comment_1_bde2b1e2c45e110d56ce98b43dd77743._comment b/doc/todo/annex_add___40__-u__124__--update__41___mode/comment_1_bde2b1e2c45e110d56ce98b43dd77743._comment
new file mode 100644
index 000000000..e6a632902
--- /dev/null
+++ b/doc/todo/annex_add___40__-u__124__--update__41___mode/comment_1_bde2b1e2c45e110d56ce98b43dd77743._comment
@@ -0,0 +1,7 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2017-04-07T19:41:02Z"
+ content="""
+Good idea, adding.
+"""]]