summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-05-18 08:29:36 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-18 08:46:57 (GMT)
commite8f990b4e4b56f214138cc475c19e5a253e9148e (patch)
tree7586c540fd88618d9ed9b5b7e6927a66cd887155 /builtin-add.c
parentc699f9b924d763b762df932769d91e3d053634a8 (diff)
downloadgit-e8f990b4e4b56f214138cc475c19e5a253e9148e.zip
git-e8f990b4e4b56f214138cc475c19e5a253e9148e.tar.gz
git-e8f990b4e4b56f214138cc475c19e5a253e9148e.tar.bz2
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>
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 089c7a8..37243f8 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -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);
}