mirror of
https://github.com/git/git.git
synced 2024-06-02 04:46:30 +02:00
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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c569b1fee1
commit
a583971f15
18
daemon.c
18
daemon.c
|
@ -150,7 +150,6 @@ static char *path_ok(char *directory)
|
||||||
{
|
{
|
||||||
static char rpath[PATH_MAX];
|
static char rpath[PATH_MAX];
|
||||||
static char interp_path[PATH_MAX];
|
static char interp_path[PATH_MAX];
|
||||||
int retried_path = 0;
|
|
||||||
char *path;
|
char *path;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
|
@ -219,22 +218,15 @@ static char *path_ok(char *directory)
|
||||||
dir = rpath;
|
dir = rpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
path = enter_repo(dir, strict_paths);
|
||||||
path = enter_repo(dir, strict_paths);
|
if (!path && base_path && base_path_relaxed) {
|
||||||
if (path)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we fail and base_path_relaxed is enabled, try without
|
* if we fail and base_path_relaxed is enabled, try without
|
||||||
* prefixing the base path
|
* prefixing the base path
|
||||||
*/
|
*/
|
||||||
if (base_path && base_path_relaxed && !retried_path) {
|
dir = directory;
|
||||||
dir = directory;
|
path = enter_repo(dir, strict_paths);
|
||||||
retried_path = 1;
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} while (1);
|
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
logerror("'%s': unable to chdir or not a git archive", dir);
|
logerror("'%s': unable to chdir or not a git archive", dir);
|
||||||
|
|
Loading…
Reference in New Issue