[PATCH] Make git add -u honor --dry-run
From: Miklos Vajna <hidden>
Date: 2016-06-15 22:44:37
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Miklos Vajna <redacted> --- On Thu, May 15, 2008 at 06:08:24PM +0200, Gustaf Hendeby [off-list ref] wrote:
I'm not familiar enough with the code to see how to best fix it.
Something like this? builtin-add.c | 3 ++- t/t2200-add-update.sh | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 4a91e3e..222497d 100644
--- a/builtin-add.c
+++ b/builtin-add.c@@ -212,7 +212,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (read_cache() < 0) die("index file corrupt"); pathspec = get_pathspec(prefix, argv); - add_files_to_cache(verbose, prefix, pathspec); + if(!show_only) + add_files_to_cache(verbose, prefix, pathspec); goto finish; }
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index b664341..13ad975 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh@@ -88,6 +88,13 @@ test_expect_success 'replace a file with a symlink' ' ' +test_expect_success 'add everything changed with --dry-run' ' + + git add -u --dry-run && + test -n "$(git diff-files)" + +' + test_expect_success 'add everything changed' ' git add -u &&
--
1.5.5.1.211.g65ea3.dirty