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:
Fredrik Gustafsson
2011-08-15 23:17:46 +02:00
committed by Junio C Hamano
parent e7a85be3cf
commit abc06822af
7 changed files with 78 additions and 54 deletions

View File

@ -360,10 +360,10 @@ test_expect_success 'update --init' '
git submodule update init > update.out &&
cat update.out &&
test_i18ngrep "not initialized" update.out &&
! test -d init/.git &&
test_must_fail git rev-parse --resolve-git-dir init/.git &&
git submodule update --init init &&
test -d init/.git
git rev-parse --resolve-git-dir init/.git
'
test_expect_success 'do not add files from a submodule' '