summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-11-05 12:18:07 -0800
committerJunio C Hamano <gitster@pobox.com>2015-11-05 12:18:08 -0800
commit4349f597f08b6dc50fc6198b8e1b96e19df37c65 (patch)
treecda184215e2f3e14bb4d9871af0df367ea0ea01f /path.c
parent53be145209eeac5972d4ea4374d667fdf594f78f (diff)
parentd78db8424ec5c3f3327441cd1a897064af39da91 (diff)
downloadgit-4349f597f08b6dc50fc6198b8e1b96e19df37c65.tar.gz
Merge branch 'nd/clone-linked-checkout' into maint
It was not possible to use a repository-lookalike created by "git worktree add" as a local source of "git clone". * nd/clone-linked-checkout: clone: better error when --reference is a linked checkout clone: allow --local from a linked checkout enter_repo: allow .git files in strict mode enter_repo: avoid duplicating logic, use is_git_directory() instead t0002: add test for enter_repo(), non-strict mode path.c: delete an extra space
Diffstat (limited to 'path.c')
-rw-r--r--path.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/path.c b/path.c
index 69265f42ce..56317a66be 100644
--- a/path.c
+++ b/path.c
@@ -445,18 +445,22 @@ const char *enter_repo(const char *path, int strict)
}
if (!suffix[i])
return NULL;
- gitfile = read_gitfile(used_path) ;
+ gitfile = read_gitfile(used_path);
if (gitfile)
strcpy(used_path, gitfile);
if (chdir(used_path))
return NULL;
path = validated_path;
}
- else if (chdir(path))
- return NULL;
+ else {
+ const char *gitfile = read_gitfile(path);
+ if (gitfile)
+ path = gitfile;
+ if (chdir(path))
+ return NULL;
+ }
- if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
- validate_headref("HEAD") == 0) {
+ if (is_git_directory(".")) {
set_git_dir(".");
check_repository_format();
return path;