git-verify-pack: insist on .idx extension
git-verify-pack can be called with a filename without .idx extension. add_packed_git() on the other hand depends on its presence. So instead of trying to call it with whatever the user gave us check for that extension and add it if it's missing. That means that you can't name your index file "blah" and your pack file ".pack" anymore ("git-verify-pack blah" currently works in that case). I think this regression is a good change. ;-) Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
Rene Scharfe committed
Aug 10, 2006 at 17:02 UTC
68f4c78b95b9d119d8888b40b0a93b93a39b2f26
1 file changed
+5
-6
verify-pack.c
+5
-6
@@ -18,13 +18,12 @@ static int verify_one_pack(const char *path, int verbose)
18
if (has_extension(arg, len, ".pack")) {
19
strcpy(arg + len - 5, ".idx");
20
len--;
21
+ } else if (!has_extension(arg, len, ".idx")) {
22
+ if (len + 4 >= PATH_MAX)
23
+ return error("name too long: %s.idx", arg);
24
+ strcpy(arg + len, ".idx");
25
+ len += 4;
26
}
22
- /* Should name foo.idx now */
23
- if ((g = add_packed_git(arg, len, 1)))
24
- break;
25
- /* No? did you name just foo? */
26
- strcpy(arg + len, ".idx");
27
- len += 4;
27
if ((g = add_packed_git(arg, len, 1)))
28
break;
29
return error("packfile %s not found.", arg);