add -i: Fix running from a subdirectory

This fixes the pathspec interactive_add() passes to the underlying
git-add--interactive helper.  When the command was run from a
subdirectory, cmd_add() already has gone up to the toplevel of the work
tree, and the helper will be spawned from there.  The pathspec given on
the command line from the user needs to be adjusted for this.

This adds "validate_pathspec()" function in the callchain, but it does
not validate yet.  The function can be changed to barf if there are
unmatching pathspec given by the user, but that is not strictly
necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2007-11-25 10:10:10 -08:00
parent 324ccbd6a0
commit 3f061887c5
3 changed files with 22 additions and 6 deletions

View File

@ -165,7 +165,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
const char **pathspec = NULL;
if (interactive) {
interactive_add(argc, argv);
interactive_add(argc, argv, prefix);
commit_style = COMMIT_AS_IS;
return get_index_file();
}