Skip to content

Commit

Permalink
builtin-add: fix unmatched pathspec warnings.
Browse files Browse the repository at this point in the history
"git add Documentation/" when Documentation directory exists
does not barf (as it should not), but "git add ." barfed when it
did not add anything.  This was because we checked for the path
prefix ("Documentation/" in the former case, and an empty string
in the latter case) for existence, and lstat("", &st) would say
"Huh?".

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed May 18, 2006
1 parent c699f9b commit e8f990b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p

/* Existing file? We must have ignored it */
match = pathspec[i];
if (!lstat(match, &st))
if (!match[0] || !lstat(match, &st))
continue;
die("pathspec '%s' did not match any files", match);
}
Expand Down

0 comments on commit e8f990b

Please sign in to comment.