Skip to content

Commit a583971

Browse files
René Scharfegitster
authored andcommitted
daemon: cleanup: replace loop with if
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c569b1f commit a583971

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

daemon.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static char *path_ok(char *directory)
150150
{
151151
static char rpath[PATH_MAX];
152152
static char interp_path[PATH_MAX];
153-
int retried_path = 0;
154153
char *path;
155154
char *dir;
156155

@@ -219,22 +218,15 @@ static char *path_ok(char *directory)
219218
dir = rpath;
220219
}
221220

222-
do {
223-
path = enter_repo(dir, strict_paths);
224-
if (path)
225-
break;
226-
221+
path = enter_repo(dir, strict_paths);
222+
if (!path && base_path && base_path_relaxed) {
227223
/*
228224
* if we fail and base_path_relaxed is enabled, try without
229225
* prefixing the base path
230226
*/
231-
if (base_path && base_path_relaxed && !retried_path) {
232-
dir = directory;
233-
retried_path = 1;
234-
continue;
235-
}
236-
break;
237-
} while (1);
227+
dir = directory;
228+
path = enter_repo(dir, strict_paths);
229+
}
238230

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

0 commit comments

Comments
 (0)