test_cmp expected "$actual"
'
-test_expect_failure 'gitdir - $GIT_DIR set while .git directory in cwd' '
+test_expect_success 'gitdir - $GIT_DIR set while .git directory in cwd' '
echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
(
GIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&
test_cmp expected "$actual"
'
+test_expect_success 'gitdir - non-existing $GIT_DIR' '
+ (
+ GIT_DIR="$TRASH_DIRECTORY/non-existing" &&
+ export GIT_DIR &&
+ test_must_fail __gitdir
+ )
+'
+
test_expect_success 'gitdir - gitfile in cwd' '
echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&