From abc06822af57347d35c0cd64b67e1faeb5b65c71 Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Mon, 15 Aug 2011 23:17:46 +0200 Subject: rev-parse: add option --resolve-git-dir Check if is a valid git-dir or a valid git-file that points to a valid git-dir. We want tests to be independent from the fact that a git-dir may be a git-file. Thus we changed tests to use this feature. Signed-off-by: Fredrik Gustafsson Mentored-by: Jens Lehmann Mentored-by: Heiko Voigt Signed-off-by: Junio C Hamano --- setup.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'setup.c') diff --git a/setup.c b/setup.c index 5ea5502e48..efad002ed2 100644 --- a/setup.c +++ b/setup.c @@ -808,3 +808,10 @@ const char *setup_git_directory(void) { return setup_git_directory_gently(NULL); } + +const char *resolve_gitdir(const char *suspect) +{ + if (is_git_directory(suspect)) + return suspect; + return read_gitfile_gently(suspect); +} -- cgit v1.2.1