git/t/t2005-checkout-index-symlinks.sh
Ævar Arnfjörð Bjarmason 4bd0785dc2 tests: don't lose exit status with "test <op> $(git ...)"
As with the preceding commit, rewrite tests that ran "git" inside
command substitution and lost the exit status of "git" so that we
notice the failing "git". This time around we're converting cases that
didn't involve a containing sub-shell around the command substitution.

In the case of "t0060-path-utils.sh" and
"t2005-checkout-index-symlinks.sh" convert the relevant code to using
the modern style of indentation and newline wrapping while having to
change it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-02-06 15:30:42 -08:00

31 lines
753 B
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2007 Johannes Sixt
#
test_description='git checkout-index on filesystem w/o symlinks test.
This tests that git checkout-index creates a symbolic link as a plain
file if core.symlinks is false.'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success \
'preparation' '
git config core.symlinks false &&
l=$(printf file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \
'the checked-out symlink must be a file' '
git checkout-index symlink &&
test -f symlink'
test_expect_success 'the file must be the blob we added during the setup' '
echo "$l" >expect &&
git hash-object -t blob symlink >actual &&
test_cmp expect actual
'
test_done