summaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-22 01:51:25 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-22 01:51:25 +0100
commit0aac1614e976164259edf5f950da4cbebe069466 (patch)
tree50f0dd772ab75c2086458b51b421bde6863574ed /setup.c
parentMerge branch 'jf/am-failure-report' (diff)
parentFix gitdir detection when in subdir of gitdir (diff)
downloadgit-0aac1614e976164259edf5f950da4cbebe069466.tar.xz
git-0aac1614e976164259edf5f950da4cbebe069466.zip
Merge branch 'sg/maint-gitdir-in-subdir'
* sg/maint-gitdir-in-subdir: Fix gitdir detection when in subdir of gitdir
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 6b277b6a11..dfda532adc 100644
--- a/setup.c
+++ b/setup.c
@@ -456,7 +456,11 @@ const char *setup_git_directory_gently(int *nongit_ok)
inside_git_dir = 1;
if (!work_tree_env)
inside_work_tree = 0;
- setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+ if (offset != len) {
+ cwd[offset] = '\0';
+ setenv(GIT_DIR_ENVIRONMENT, cwd, 1);
+ } else
+ setenv(GIT_DIR_ENVIRONMENT, ".", 1);
check_repository_format_gently(nongit_ok);
return NULL;
}