git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/3] daemon: cleanup: replace loop with if
Date: Fri, 26 Dec 2008 11:01:57 +0100	[thread overview]
Message-ID: <1230285717.6728.40.camel@ubuntu.ubuntu-domain> (raw)
In-Reply-To: <1230284785.6728.26.camel@ubuntu.ubuntu-domain>

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>
---
 daemon.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/daemon.c b/daemon.c
index 8c317be..4468fb9 100644
--- a/daemon.c
+++ b/daemon.c
@@ -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;
 
@@ -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);
-- 
1.6.1

  reply	other threads:[~2008-12-26 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-26  9:46 [PATCH 1/3] daemon: handle freopen() failure René Scharfe
2008-12-26 10:01 ` René Scharfe [this message]
2008-12-26 10:12   ` [PATCH 3/3] daemon: cleanup: factor out xstrdup_tolower() René Scharfe
2008-12-26 10:17 ` [PATCH] merge-file: handle freopen() failure René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1230285717.6728.40.camel@ubuntu.ubuntu-domain \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).