summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-01 11:13:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-05 08:44:10 (GMT)
commit1abf0950638d4f3279d059a1365da9c253d5718a (patch)
tree215a85a6554280fd44ffb2dc81464045a92ebe76 /builtin-add.c
parent097971f5f564dbd832eea774ae0cdcfa03ba35ac (diff)
downloadgit-1abf0950638d4f3279d059a1365da9c253d5718a.zip
git-1abf0950638d4f3279d059a1365da9c253d5718a.tar.gz
git-1abf0950638d4f3279d059a1365da9c253d5718a.tar.bz2
git-add: adjust to the get_pathspec() changes.
We would need to notice and fail if command line had a nonsense pathspec. Earlier get_pathspec() returned all the inputs including bad ones, but the new one issues warnings and removes offending ones from its return value, so the callers need to be adjusted to notice it. Additional test scripts were initially from Robin Rosenberg, further fixed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 4a91e3e..820110e 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -228,6 +228,18 @@ int cmd_add(int argc, const char **argv, const char *prefix)
goto finish;
}
+ if (*argv) {
+ /* Was there an invalid path? */
+ if (pathspec) {
+ int num;
+ for (num = 0; pathspec[num]; num++)
+ ; /* just counting */
+ if (argc != num)
+ exit(1); /* error message already given */
+ } else
+ exit(1); /* error message already given */
+ }
+
fill_directory(&dir, pathspec, ignored_too);
if (show_only) {