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

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Tue, 16 Feb 2010 23:04:56 +0700

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 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