diff options
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | 2006-08-10 17:02:34 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-10 14:15:41 -0700 |
commit | fc5fc50980958f742a9f3d79fb7a64f02e87877a (patch) | |
tree | e80e386ffa61a34835ad948cedfc867d291fefc3 /verify-pack.c | |
parent | 68f4c78b95b9d119d8888b40b0a93b93a39b2f26 (diff) | |
download | git-fc5fc50980958f742a9f3d79fb7a64f02e87877a.tar.gz |
git-verify-pack: get rid of while loop
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>
Diffstat (limited to 'verify-pack.c')
-rw-r--r-- | verify-pack.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/verify-pack.c b/verify-pack.c index 002b711617..c7293140f6 100644 --- a/verify-pack.c +++ b/verify-pack.c @@ -11,23 +11,23 @@ static int verify_one_pack(const char *path, int verbose) 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); } |