diff options
author | Fredrik Gustafsson <iveqy@iveqy.com> | 2011-08-15 23:17:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-16 11:04:31 -0700 |
commit | abc06822af57347d35c0cd64b67e1faeb5b65c71 (patch) | |
tree | 6a6484a355e2e5b0a8b7b839c0e3ea6b1bd67457 /setup.c | |
parent | e7a85be3cfc4ee017f59f1d1f8ceb63d7c88c9c8 (diff) | |
download | git-abc06822af57347d35c0cd64b67e1faeb5b65c71.tar.gz |
rev-parse: add option --resolve-git-dir <path>
Check if <path> 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 <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); +} |