Skip to content

Commit 622f98e

Browse files
j6tgitster
authored andcommitted
t3509, t4023, t4114: use test_ln_s_add to remove SYMLINKS prerequisite
In t4023 and t4114, we have to remove the entries using 'git rm' because otherwise the entries that must turn from symbolic links to regular files would stay symbolic links in the index. For the same reason, we have to use 'git mv' instead of plain 'mv' in t3509. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e40db07 commit 622f98e

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

t/t3509-cherry-pick-merge-df.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,23 @@ test_expect_success 'Initialize repository' '
1010
git commit -m a
1111
'
1212

13-
test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
13+
test_expect_success 'Setup rename across paths each below D/F conflicts' '
1414
mkdir b &&
15-
ln -s ../a b/a &&
16-
git add b &&
15+
test_ln_s_add ../a b/a &&
1716
git commit -m b &&
1817
1918
git checkout -b branch &&
2019
rm b/a &&
21-
mv a b/a &&
22-
ln -s b/a a &&
23-
git add . &&
20+
git mv a b/a &&
21+
test_ln_s_add b/a a &&
2422
git commit -m swap &&
2523
2624
>f1 &&
2725
git add f1 &&
2826
git commit -m f1
2927
'
3028

31-
test_expect_success SYMLINKS 'Cherry-pick succeeds with rename across D/F conflicts' '
29+
test_expect_success 'Cherry-pick succeeds with rename across D/F conflicts' '
3230
git reset --hard &&
3331
git checkout master^0 &&
3432
git cherry-pick branch

t/t4023-diff-rename-typechange.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,44 @@ test_description='typechange rename detection'
44

55
. ./test-lib.sh
66

7-
test_expect_success SYMLINKS setup '
7+
test_expect_success setup '
88
99
rm -f foo bar &&
1010
cat "$TEST_DIRECTORY"/../COPYING >foo &&
11-
ln -s linklink bar &&
12-
git add foo bar &&
11+
test_ln_s_add linklink bar &&
12+
git add foo &&
1313
git commit -a -m Initial &&
1414
git tag one &&
1515
16-
rm -f foo bar &&
16+
git rm -f foo bar &&
1717
cat "$TEST_DIRECTORY"/../COPYING >bar &&
18-
ln -s linklink foo &&
19-
git add foo bar &&
18+
test_ln_s_add linklink foo &&
19+
git add bar &&
2020
git commit -a -m Second &&
2121
git tag two &&
2222
23-
rm -f foo bar &&
23+
git rm -f foo bar &&
2424
cat "$TEST_DIRECTORY"/../COPYING >foo &&
2525
git add foo &&
2626
git commit -a -m Third &&
2727
git tag three &&
2828
2929
mv foo bar &&
30-
ln -s linklink foo &&
31-
git add foo bar &&
30+
test_ln_s_add linklink foo &&
31+
git add bar &&
3232
git commit -a -m Fourth &&
3333
git tag four &&
3434
3535
# This is purely for sanity check
3636
37-
rm -f foo bar &&
37+
git rm -f foo bar &&
3838
cat "$TEST_DIRECTORY"/../COPYING >foo &&
3939
cat "$TEST_DIRECTORY"/../Makefile >bar &&
4040
git add foo bar &&
4141
git commit -a -m Fifth &&
4242
git tag five &&
4343
44-
rm -f foo bar &&
44+
git rm -f foo bar &&
4545
cat "$TEST_DIRECTORY"/../Makefile >foo &&
4646
cat "$TEST_DIRECTORY"/../COPYING >bar &&
4747
git add foo bar &&
@@ -50,7 +50,7 @@ test_expect_success SYMLINKS setup '
5050
5151
'
5252

53-
test_expect_success SYMLINKS 'cross renames to be detected for regular files' '
53+
test_expect_success 'cross renames to be detected for regular files' '
5454
5555
git diff-tree five six -r --name-status -B -M | sort >actual &&
5656
{
@@ -61,7 +61,7 @@ test_expect_success SYMLINKS 'cross renames to be detected for regular files' '
6161
6262
'
6363

64-
test_expect_success SYMLINKS 'cross renames to be detected for typechange' '
64+
test_expect_success 'cross renames to be detected for typechange' '
6565
6666
git diff-tree one two -r --name-status -B -M | sort >actual &&
6767
{
@@ -72,7 +72,7 @@ test_expect_success SYMLINKS 'cross renames to be detected for typechange' '
7272
7373
'
7474

75-
test_expect_success SYMLINKS 'moves and renames' '
75+
test_expect_success 'moves and renames' '
7676
7777
git diff-tree three four -r --name-status -B -M | sort >actual &&
7878
{

t/t4114-apply-typechange.sh

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ test_description='git apply should not get confused with type changes.
99

1010
. ./test-lib.sh
1111

12-
test_expect_success SYMLINKS 'setup repository and commits' '
12+
test_expect_success 'setup repository and commits' '
1313
echo "hello world" > foo &&
1414
echo "hi planet" > bar &&
1515
git update-index --add foo bar &&
1616
git commit -m initial &&
1717
git branch initial &&
1818
rm -f foo &&
19-
ln -s bar foo &&
20-
git update-index foo &&
19+
test_ln_s_add bar foo &&
2120
git commit -m "foo symlinked to bar" &&
2221
git branch foo-symlinked-to-bar &&
23-
rm -f foo &&
22+
git rm -f foo &&
2423
echo "how far is the sun?" > foo &&
25-
git update-index foo &&
24+
git update-index --add foo &&
2625
git commit -m "foo back to file" &&
2726
git branch foo-back-to-file &&
2827
printf "\0" > foo &&
@@ -42,77 +41,77 @@ test_expect_success SYMLINKS 'setup repository and commits' '
4241
git branch foo-baz-renamed-from-foo
4342
'
4443

45-
test_expect_success SYMLINKS 'file renamed from foo to foo/baz' '
44+
test_expect_success 'file renamed from foo to foo/baz' '
4645
git checkout -f initial &&
4746
git diff-tree -M -p HEAD foo-baz-renamed-from-foo > patch &&
4847
git apply --index < patch
4948
'
5049
test_debug 'cat patch'
5150

5251

53-
test_expect_success SYMLINKS 'file renamed from foo/baz to foo' '
52+
test_expect_success 'file renamed from foo/baz to foo' '
5453
git checkout -f foo-baz-renamed-from-foo &&
5554
git diff-tree -M -p HEAD initial > patch &&
5655
git apply --index < patch
5756
'
5857
test_debug 'cat patch'
5958

6059

61-
test_expect_success SYMLINKS 'directory becomes file' '
60+
test_expect_success 'directory becomes file' '
6261
git checkout -f foo-becomes-a-directory &&
6362
git diff-tree -p HEAD initial > patch &&
6463
git apply --index < patch
6564
'
6665
test_debug 'cat patch'
6766

6867

69-
test_expect_success SYMLINKS 'file becomes directory' '
68+
test_expect_success 'file becomes directory' '
7069
git checkout -f initial &&
7170
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
7271
git apply --index < patch
7372
'
7473
test_debug 'cat patch'
7574

7675

77-
test_expect_success SYMLINKS 'file becomes symlink' '
76+
test_expect_success 'file becomes symlink' '
7877
git checkout -f initial &&
7978
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
8079
git apply --index < patch
8180
'
8281
test_debug 'cat patch'
8382

8483

85-
test_expect_success SYMLINKS 'symlink becomes file' '
84+
test_expect_success 'symlink becomes file' '
8685
git checkout -f foo-symlinked-to-bar &&
8786
git diff-tree -p HEAD foo-back-to-file > patch &&
8887
git apply --index < patch
8988
'
9089
test_debug 'cat patch'
9190

92-
test_expect_success SYMLINKS 'binary file becomes symlink' '
91+
test_expect_success 'binary file becomes symlink' '
9392
git checkout -f foo-becomes-binary &&
9493
git diff-tree -p --binary HEAD foo-symlinked-to-bar > patch &&
9594
git apply --index < patch
9695
'
9796
test_debug 'cat patch'
9897

99-
test_expect_success SYMLINKS 'symlink becomes binary file' '
98+
test_expect_success 'symlink becomes binary file' '
10099
git checkout -f foo-symlinked-to-bar &&
101100
git diff-tree -p --binary HEAD foo-becomes-binary > patch &&
102101
git apply --index < patch
103102
'
104103
test_debug 'cat patch'
105104

106105

107-
test_expect_success SYMLINKS 'symlink becomes directory' '
106+
test_expect_success 'symlink becomes directory' '
108107
git checkout -f foo-symlinked-to-bar &&
109108
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
110109
git apply --index < patch
111110
'
112111
test_debug 'cat patch'
113112

114113

115-
test_expect_success SYMLINKS 'directory becomes symlink' '
114+
test_expect_success 'directory becomes symlink' '
116115
git checkout -f foo-becomes-a-directory &&
117116
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
118117
git apply --index < patch

0 commit comments

Comments
 (0)