]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7515-status-symlinks.sh
Merge branch 'po/readme-mention-contributor-hints'
[thirdparty/git.git] / t / t7515-status-symlinks.sh
1 #!/bin/sh
2
3 test_description='git status and symlinks'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
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
18 '
19
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
26 '
27
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
42 '
43
44 test_done