@matheusbsbs / matheus-bagliano / commits / a583971f15
Fork 0

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>

René Scharfe committed Dec 26, 2008 at 11:01 UTC a583971f15e520c8cb5f9967383903e13c353c86
1 file changed +5 -13
daemon.c
+5 -13
@@ -150,7 +150,6 @@ static char *path_ok(char *directory)
150 {
151 static char rpath[PATH_MAX];
152 static char interp_path[PATH_MAX];
153 - int retried_path = 0;
153 char *path;
154 char *dir;
155
@@ -219,22 +218,15 @@ static char *path_ok(char *directory)
218 dir = rpath;
219 }
220
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) {
223 /*
224 * if we fail and base_path_relaxed is enabled, try without
225 * prefixing the base path
226 */
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 + }
230
231 if (!path) {
232 logerror("'%s': unable to chdir or not a git archive", dir);