git-add -u paths... now works from subdirectory
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>
diff --git a/builtin-add.c b/builtin-add.c
index a5fae7c..07e3ddf 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -123,12 +123,12 @@
}
}
-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;
@@ -209,7 +209,7 @@
}
if (take_worktree_changes) {
- update(verbose, argv + i);
+ update(verbose, prefix, argv + i);
goto finish;
}