mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
enter_repo: allow .git files in strict mode
Strict mode is about not guessing where .git is. If the user points to a .git file, we know exactly where the target .git dir will be. This makes it possible to serve .git files as repository on the server side. This may be needed even in local clone case because transport.c code uses upload-pack for fetching remote refs. But right now the clone/transport code goes with non-strict. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
0f64cc407f
commit
1f5fbe1fe2
9
path.c
9
path.c
@@ -438,8 +438,13 @@ 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 (is_git_directory(".")) {
|
||||
set_git_dir(".");
|
||||
|
||||
Reference in New Issue
Block a user