summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 68f4c78)
raw | patch | inline | side by side (parent: 68f4c78)
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Thu, 10 Aug 2006 15:02:34 +0000 (17:02 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 10 Aug 2006 21:15:41 +0000 (14:15 -0700) |
Get rid of that while loop which was apparently used as a way to avoid
goto's (why?). It's easy now because there is only one break left at
the end of it. Also make the comment clearer.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
goto's (why?). It's easy now because there is only one break left at
the end of it. Also make the comment clearer.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
verify-pack.c | patch | blob | history |
diff --git a/verify-pack.c b/verify-pack.c
index 002b7116171d3305f5b69955852385a5ec50ed0f..c7293140f61798678ed8a25680c538a52ac225a8 100644 (file)
--- a/verify-pack.c
+++ b/verify-pack.c
if (len >= PATH_MAX)
return error("name too long: %s", path);
- while (1) {
- /* Should name foo.idx, but foo.pack may be named;
- * convert it to foo.idx
- */
- if (has_extension(arg, len, ".pack")) {
- strcpy(arg + len - 5, ".idx");
- len--;
- } else if (!has_extension(arg, len, ".idx")) {
- if (len + 4 >= PATH_MAX)
- return error("name too long: %s.idx", arg);
- strcpy(arg + len, ".idx");
- len += 4;
- }
- if ((g = add_packed_git(arg, len, 1)))
- break;
- return error("packfile %s not found.", arg);
+ /*
+ * In addition to "foo.idx" we accept "foo.pack" and "foo";
+ * normalize these forms to "foo.idx" for add_packed_git().
+ */
+ if (has_extension(arg, len, ".pack")) {
+ strcpy(arg + len - 5, ".idx");
+ len--;
+ } else if (!has_extension(arg, len, ".idx")) {
+ if (len + 4 >= PATH_MAX)
+ return error("name too long: %s.idx", arg);
+ strcpy(arg + len, ".idx");
+ len += 4;
}
+
+ if (!(g = add_packed_git(arg, len, 1)))
+ return error("packfile %s not found.", arg);
+
return verify_pack(g, verbose);
}