blob: 67d18cfa104b867bfdd2004df0bc8c9e305cfdc9 [file] [log] [blame]
Johannes Sixt78a8d642007-03-02 22:11:30 +01001#!/bin/sh
2#
3# Copyright (c) 2007 Johannes Sixt
4#
5
Junio C Hamano5be60072007-07-02 22:52:14 -07006test_description='git checkout-index on filesystem w/o symlinks test.
Johannes Sixt78a8d642007-03-02 22:11:30 +01007
Junio C Hamano5be60072007-07-02 22:52:14 -07008This tests that git checkout-index creates a symbolic link as a plain
Johannes Sixt78a8d642007-03-02 22:11:30 +01009file if core.symlinks is false.'
10
Ævar Arnfjörð Bjarmasonb7bcdbd2021-10-12 15:56:41 +020011TEST_PASSES_SANITIZE_LEAK=true
Johannes Sixt78a8d642007-03-02 22:11:30 +010012. ./test-lib.sh
13
14test_expect_success \
15'preparation' '
Junio C Hamano5be60072007-07-02 22:52:14 -070016git config core.symlinks false &&
Brian Gernhardt6ecfd912008-10-31 01:09:13 -040017l=$(printf file | git hash-object -t blob -w --stdin) &&
Junio C Hamano5be60072007-07-02 22:52:14 -070018echo "120000 $l symlink" | git update-index --index-info'
Johannes Sixt78a8d642007-03-02 22:11:30 +010019
20test_expect_success \
21'the checked-out symlink must be a file' '
Junio C Hamano5be60072007-07-02 22:52:14 -070022git checkout-index symlink &&
Johannes Sixt78a8d642007-03-02 22:11:30 +010023test -f symlink'
24
Ævar Arnfjörð Bjarmason4bd07852023-02-06 23:44:31 +010025test_expect_success 'the file must be the blob we added during the setup' '
26 echo "$l" >expect &&
27 git hash-object -t blob symlink >actual &&
28 test_cmp expect actual
29'
Johannes Sixt78a8d642007-03-02 22:11:30 +010030
31test_done