git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Vajna <vmiklos@frugalware.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Gustaf Hendeby <hendeby@isy.liu.se>,
	Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] Make git add -u honor --dry-run
Date: Thu, 15 May 2008 18:20:59 +0200	[thread overview]
Message-ID: <1210868459-9511-1-git-send-email-vmiklos@frugalware.org> (raw)
In-Reply-To: <482C5FF8.1060200@isy.liu.se>

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

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

  reply	other threads:[~2008-05-15 16:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15 16:08 [BUG] git add -u ignores --dry-run flag Gustaf Hendeby
2008-05-15 16:20 ` Miklos Vajna [this message]
2008-05-15 18:46   ` [PATCH] Make git add -u honor --dry-run Gustaf Hendeby
2008-05-15 23:42   ` Re* " Junio C Hamano
2008-05-16  0:13     ` Miklos Vajna
2008-05-19 22:14     ` Gustaf Hendeby
2008-05-22 18:16       ` Junio C Hamano
2008-05-22 19:34         ` Gustaf Hendeby
2008-05-22 20:38           ` Junio C Hamano
2008-05-22 21:12             ` Gustaf Hendeby
2008-05-22 21:59               ` [PATCH] Make git add -n and git -u -n output consistent Gustaf Hendeby
2008-05-23  4:40                 ` Junio C Hamano
2008-05-23  8:14                   ` Gustaf Hendeby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1210868459-9511-1-git-send-email-vmiklos@frugalware.org \
    --to=vmiklos@frugalware.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hendeby@isy.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).