summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a4882c2)
raw | patch | inline | side by side (parent: a4882c2)
author | Salikh Zakirov <salikh.zakirov@gmail.com> | |
Wed, 15 Aug 2007 17:01:43 +0000 (02:01 +0900) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 15 Aug 2007 21:28:34 +0000 (14:28 -0700) |
git-add -u also takes the path limiters, but unlike the
command without the -u option, the code forgot that it
could be invoked from a subdirectory, and did not correctly
handle the prefix.
Signed-off-by: Salikh Zakirov <salikh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
command without the -u option, the code forgot that it
could be invoked from a subdirectory, and did not correctly
handle the prefix.
Signed-off-by: Salikh Zakirov <salikh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-add.c | patch | blob | history | |
t/t2200-add-update.sh | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index a5fae7ca1723f277634b7a6f36af75e5dac26bbb..07e3ddfd0a49fd42206cf421924db17620fb690a 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
}
}
-static void update(int verbose, const char **files)
+static void update(int verbose, const char *prefix, const char **files)
{
struct rev_info rev;
- init_revisions(&rev, "");
+ init_revisions(&rev, prefix);
setup_revisions(0, NULL, &rev, NULL);
- rev.prune_data = get_pathspec(rev.prefix, files);
+ rev.prune_data = get_pathspec(prefix, files);
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
rev.diffopt.format_callback_data = &verbose;
}
if (take_worktree_changes) {
- update(verbose, argv + i);
+ update(verbose, prefix, argv + i);
goto finish;
}
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index 4c7c6af432bd788350d322f2debc4bcea7f1636c..58cd7f31bed90fd24d1f5cd43ff0e26c922ea4ab 100755 (executable)
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
'
+test_expect_success 'update from a subdirectory' '
+ (
+ cd dir1 &&
+ echo more >sub2 &&
+ git add -u sub2
+ )
+'
+
+test_expect_success 'change gets noticed' '
+
+ test "$(git diff-files --name-status dir1)" = ""
+
+'
+
test_done