Thread (27 messages) flat view 27 messages, 1 author, 2016-06-15
DORMANTno replies

[WIP PATCH 05/26] enter_repo(): use setup_git_directory_gently internally

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:48:17
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 path.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/path.c b/path.c
index 0005df3..6a311d7 100644
--- a/path.c
+++ b/path.c
@@ -281,6 +281,7 @@ char *enter_repo(char *path, int strict)
 {
 	static char used_path[PATH_MAX];
 	static char validated_path[PATH_MAX];
+	int nongit_ok;
 
 	if (!path)
 		return NULL;
@@ -334,12 +335,9 @@ char *enter_repo(char *path, int strict)
 	else if (chdir(path))
 		return NULL;
 
-	if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
-	    validate_headref("HEAD") == 0) {
-		set_git_dir(".");
-		check_repository_format();
+	setup_git_directory_gently(&nongit_ok);
+	if (!nongit_ok)
 		return path;
-	}
 
 	return NULL;
 }
-- 
1.7.0.195.g637a2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help