builtin-add: fix unmatched pathspec warnings.
"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>
Junio C Hamano committed
May 18, 2006 at 01:29 UTC
e8f990b4e4b56f214138cc475c19e5a253e9148e
1 file changed
+1
-1
builtin-add.c
+1
-1
@@ -123,7 +123,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
123
124
/* Existing file? We must have ignored it */
125
match = pathspec[i];
126
- if (!lstat(match, &st))
126
+ if (!match[0] || !lstat(match, &st))
127
continue;
128
die("pathspec '%s' did not match any files", match);
129
}