Git development
 help / color / mirror / Atom feed
From: David Reiss <dreiss@facebook.com>
To: git@vger.kernel.org
Subject: [PATCH 1/2] chdir after computing new cwd in check_repository_format_gently
Date: Tue, 13 May 2008 22:45:21 -0700	[thread overview]
Message-ID: <482A7C71.6050509@facebook.com> (raw)

In preparation for adding a check before the chdir.
This should be a no-op because the cwd is not read in the interim
and any nonlocal exits either chdir to an absolute path or die.

Signed-off-by: David Reiss <dreiss@facebook.com>
---
I sent this in a few weeks ago, but got no response.  Probably because I
messed up the formatting.  Hopefully I'm getting it right this time.

 setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index b8fd476..c54f2b6 100644
--- a/setup.c
+++ b/setup.c
@@ -443,7 +443,6 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			check_repository_format_gently(nongit_ok);
 			return NULL;
 		}
-		chdir("..");
 		do {
 			if (!offset) {
 				if (nongit_ok) {
@@ -455,6 +454,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 				die("Not a git repository");
 			}
 		} while (cwd[--offset] != '/');
+		chdir("..");
 	}
 
 	inside_git_dir = 0;
-- 
1.5.4

             reply	other threads:[~2008-05-14  5:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14  5:45 David Reiss [this message]
2008-05-14  8:02 ` [PATCH 1/2] chdir after computing new cwd in check_repository_format_gently Johannes Schindelin

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=482A7C71.6050509@facebook.com \
    --to=dreiss@facebook.com \
    --cc=git@vger.kernel.org \
    /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