Git development
 help / color / mirror / Atom feed
From: Pauli Virtanen <pav@iki.fi>
To: git@vger.kernel.org
Cc: Pauli Virtanen <pav@iki.fi>
Subject: [PATCH] git-add--interactive: never skip files included in index
Date: Sat, 10 Oct 2009 18:51:45 +0300	[thread overview]
Message-ID: <1255189906-16049-1-git-send-email-pav@iki.fi> (raw)

Make "git add -p" to not skip files that are in index even if they are
excluded (by .gitignore etc.). This fixes the contradictory behavior
that "git status" and "git commit -a" listed such files as modified, but
"git add -p FILENAME" ignored them.

Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
 git-add--interactive.perl  |    2 +-
 t/t3701-add-interactive.sh |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 392efb9..69aeaf0 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -259,7 +259,7 @@ sub list_modified {
 		@tracked = map {
 			chomp $_;
 			unquote_path($_);
-		} run_cmd_pipe(qw(git ls-files --exclude-standard --), @ARGV);
+		} run_cmd_pipe(qw(git ls-files --), @ARGV);
 		return if (!@tracked);
 	}
 
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 62fd65e..89bfdcb 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -138,6 +138,24 @@ test_expect_success 'real edit works' '
 	test_cmp expected output
 '
 
+cat >.gitignore <<EOF
+file
+EOF
+cat >file <<EOF
+changed
+EOF
+test_expect_success 'skip files similarly as commit -a' '
+	git reset
+	echo y | git add -p file &&
+	git diff >output &&
+	git reset &&
+	git commit -am commit &&
+	git diff >expected &&
+	test_cmp expected output &&
+	git reset --hard HEAD^
+'
+rm -f .gitignore
+
 if test "$(git config --bool core.filemode)" = false
 then
 	say 'skipping filemode tests (filesystem does not properly support modes)'
-- 
1.6.3.3

             reply	other threads:[~2009-10-10 16:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-10 15:51 Pauli Virtanen [this message]
2009-10-11 18:52 ` [PATCH] git-add--interactive: never skip files included in index Junio C Hamano
2009-10-11 19:14   ` Jeff King
2009-10-11 22:22     ` Junio C Hamano
2009-10-12  1:40       ` Jeff King
2009-10-12  2:46         ` Junio C Hamano
2009-10-12  5:11           ` Jeff King
2009-10-12 23:42             ` Junio C Hamano

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=1255189906-16049-1-git-send-email-pav@iki.fi \
    --to=pav@iki.fi \
    --cc=git@vger.kernel.org \
    /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