debian: apply upstream changes to avoid v2.45.1 being a regression
[git/debian.git] / t / t7515-status-symlinks.sh
blobe3d6bb67bf95a666f2268e412db4301513746b2f
1 #!/bin/sh
3 test_description='git status and symlinks'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup' '
9 echo .gitignore >.gitignore &&
10 echo actual >>.gitignore &&
11 echo expect >>.gitignore &&
12 mkdir dir &&
13 echo x >dir/file1 &&
14 echo y >dir/file2 &&
15 git add dir &&
16 git commit -m initial &&
17 git tag initial
20 test_expect_success SYMLINKS 'symlink to a directory' '
21 test_when_finished "rm symlink" &&
22 ln -s dir symlink &&
23 echo "?? symlink" >expect &&
24 git status --porcelain >actual &&
25 test_cmp expect actual
28 test_expect_success SYMLINKS 'symlink replacing a directory' '
29 test_when_finished "rm -rf copy && git reset --hard initial" &&
30 mkdir copy &&
31 cp dir/file1 copy/file1 &&
32 echo "changed in copy" >copy/file2 &&
33 git add copy &&
34 git commit -m second &&
35 rm -rf copy &&
36 ln -s dir copy &&
37 echo " D copy/file1" >expect &&
38 echo " D copy/file2" >>expect &&
39 echo "?? copy" >>expect &&
40 git status --porcelain >actual &&
41 test_cmp expect actual
44 test_done