summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-15 22:43:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-15 22:43:40 (GMT)
commitb9d23c21104fd7eac8163b65248fae6e580291cc (patch)
tree3435670a764b0e87b14b598148b4a5a26941d7c3 /path.c
parent6652939ce8cacb147bce2f0c3503486915ca5a73 (diff)
parentd78db8424ec5c3f3327441cd1a897064af39da91 (diff)
downloadgit-b9d23c21104fd7eac8163b65248fae6e580291cc.zip
git-b9d23c21104fd7eac8163b65248fae6e580291cc.tar.gz
git-b9d23c21104fd7eac8163b65248fae6e580291cc.tar.bz2
Merge branch 'nd/clone-linked-checkout'
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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/path.c b/path.c
index 5ec3490..62a2ae8 100644
--- a/path.c
+++ b/path.c
@@ -668,11 +668,15 @@ const char *enter_repo(const char *path, int strict)
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;