Fix git-update-cache --cacheinfo error message.
authorJunio C Hamano <junkio@cox.net>
Sun, 8 May 2005 22:31:33 +0000 (15:31 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 8 May 2005 22:31:33 +0000 (15:31 -0700)
The error detection logic was too lazy to distinguish parameter
error and unable-to-add case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
update-cache.c

index 69b1afe..2f5d620 100644 (file)
@@ -369,8 +369,10 @@ int main(int argc, char **argv)
                                continue;
                        }
                        if (!strcmp(path, "--cacheinfo")) {
-                               if (i+3 >= argc || add_cacheinfo(argv[i+1], argv[i+2], argv[i+3]))
+                               if (i+3 >= argc)
                                        die("update-cache: --cacheinfo <mode> <sha1> <path>");
+                               if (add_cacheinfo(argv[i+1], argv[i+2], argv[i+3]))
+                                       die("update-cache: --cacheinfo cannot add %s", argv[i+3]);
                                i += 3;
                                continue;
                        }