[PATCH] Make git add -u honor --dry-run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Miklos Vajna <vmiklos@xxxxxxxxxxxxxx>
---

On Thu, May 15, 2008 at 06:08:24PM +0200, Gustaf Hendeby <hendeby@xxxxxxxxxx> 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux