From: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Test case for a problem with git add -u from subdirectory
Date: Wed, 20 Feb 2008 16:32:15 +0200 [thread overview]
Message-ID: <20080220143215.GA23053@localdomain> (raw)
Manual page for "git-add -u" says:
Update only files that git already knows about. This is similar to
what "git commit -a" does in preparation for making a commit, except
that the update is limited to paths specified on the command line. If
no paths are specified, all tracked files are updated.
The key sentence being: "If no paths are specified, all tracked files
are updated." If one modifies a file in subdir1, then goes to subdir2
and performs "git add -u" the modified file in subdir1 is not added to
the index. This test case demonstrates the problem.
Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi>
---
I found a possible problem in "git add -u" command without any
paths. Modified files located in a different subdirectory are not
added to the index even though the documentation says that in this
case all tracked files should be. Maybe this is caused by a bug in
"git add"? Or is the problem in the documentation?
In any case, this patch contains a test case that demonstrates the
problem.
t/t2200-add-update.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index 24f892f..5815ec5 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -80,6 +80,22 @@ test_expect_success 'change gets noticed' '
'
+test_expect_success 'update from a different subdirectory' '
+ (
+ cd dir1 &&
+ echo addmore >sub2 &&
+ cd ../dir2 &&
+ git add -u
+ )
+
+'
+
+test_expect_success 'change gets noticed' '
+
+ test "$(git diff-files --name-status dir1)" = ""
+
+'
+
test_expect_success 'replace a file with a symlink' '
rm foo &&
--
1.5.4.2
next reply other threads:[~2008-02-20 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 14:32 Pekka Kaitaniemi [this message]
2008-02-20 18:37 ` [PATCH] Test case for a problem with git add -u from subdirectory Junio C Hamano
2008-02-20 19:31 ` Pekka Kaitaniemi
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=20080220143215.GA23053@localdomain \
--to=kaitanie@cc.helsinki.fi \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).