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>
This commit is contained in:
committed by
Junio C Hamano
parent
e7a85be3cf
commit
abc06822af
@ -468,6 +468,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 2 && !strcmp(argv[1], "--resolve-git-dir")) {
|
||||
const char *gitdir = resolve_gitdir(argv[2]);
|
||||
if (!gitdir)
|
||||
die("not a gitdir '%s'", argv[2]);
|
||||
puts(gitdir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 1 && !strcmp("-h", argv[1]))
|
||||
usage(builtin_rev_parse_usage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user