In the case where setup_git_directory_gently fails, avoid the last
chdir("..") by moving it after the ceil_offset check.
Signed-off-by: David Reiss <dreiss@facebook.com>
---
Johannes originally asked me to squash this, then asked me to keep the
patch minimal. I'm including it here in case anyone else thinks it should
go in. It should be harmless because getcwd is not called in the loop,
and any nonlocal exit from the loop is either a "die" or does a chdir
to cwd, which is an absolute path.
setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/setup.c b/setup.c
index c14b106..045ca20 100644
--- a/setup.c
+++ b/setup.c
@@ -446,7 +446,6 @@ const char *setup_git_directory_gently(int *nongit_ok)
check_repository_format_gently(nongit_ok);
return NULL;
}
- chdir("..");
while (--offset > ceil_offset && cwd[offset] != '/');
if (offset <= ceil_offset) {
if (nongit_ok) {
@@ -457,6 +456,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
die("Not a git repository");
}
+ chdir("..");
}
inside_git_dir = 0;
--
1.5.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Linus Torvalds | Linux 2.6.27-rc8 |
| Jared Hulbert | [PATCH 00/10] AXFS: Advanced XIP filesystem |
| Eric Paris | Re: [malware-list] [RFC 0/5] [TALPA] Intro to a linux interface for on access scan... |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Jakub Narebski | Re: VCS comparison table |
| Junio C Hamano | Re: [PATCH 0/2] Making "git commit" to mean "git commit -a". |
| Toby White | Using Filemerge.app as a git-diff viewer |
| Ismail | Re: [ANNOUNCE] GIT 1.5.3-rc4 |
| Leon Dippenaar | New tcp stack attack |
| Richard Stallman | Real men don't attack straw men |
| Predrag Punosevac | Skype on the OpenBSD |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Hugh Dickins | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jon Smirl | e1000 tcp checksum incorrect, x86 64b |
| David Miller | [GIT]: Networking |
