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 69b1afec94ef0a6716c85f128696c1da835433e9..2f5d620fd8b849d761a2bf337ecdd86f251271ac 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;
                        }