Skip to content

Commit

Permalink
daemon: cleanup: replace loop with if
Browse files Browse the repository at this point in the history
Replace a loop around an enter_repo() call, which was used to retry
a single time with a different parameter in case the first call fails,
with two calls and an if.  This is shorter and cleaner.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Dec 27, 2008
1 parent c569b1f commit a583971
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static char *path_ok(char *directory)
{
static char rpath[PATH_MAX];
static char interp_path[PATH_MAX];
int retried_path = 0;
char *path;
char *dir;

Expand Down Expand Up @@ -219,22 +218,15 @@ static char *path_ok(char *directory)
dir = rpath;
}

do {
path = enter_repo(dir, strict_paths);
if (path)
break;

path = enter_repo(dir, strict_paths);
if (!path && base_path && base_path_relaxed) {
/*
* if we fail and base_path_relaxed is enabled, try without
* prefixing the base path
*/
if (base_path && base_path_relaxed && !retried_path) {
dir = directory;
retried_path = 1;
continue;
}
break;
} while (1);
dir = directory;
path = enter_repo(dir, strict_paths);
}

if (!path) {
logerror("'%s': unable to chdir or not a git archive", dir);
Expand Down

0 comments on commit a583971

Please sign in to comment.