Skip to content

Commit b83e131

Browse files
committed
Merge branch 'en/tests-cleanup-leftover-untracked'
Test clean-up. * en/tests-cleanup-leftover-untracked: tests: remove leftover untracked files
2 parents 91b2c79 + f222bd3 commit b83e131

12 files changed

+18
-4
lines changed

t/t0090-cache-tree.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ test_expect_success 'reset --hard gives cache-tree' '
195195

196196
test_expect_success 'reset --hard without index gives cache-tree' '
197197
rm -f .git/index &&
198+
git clean -fd &&
198199
git reset --hard &&
199200
test_cache_tree
200201
'

t/t2021-checkout-overwrite.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' '
4848

4949
test_expect_success SYMLINKS 'the symlink remained' '
5050
51+
test_when_finished "rm a/b" &&
5152
test -h a/b
5253
'
5354

t/t3404-rebase-interactive.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ test_expect_success 'abort with error when new base cannot be checked out' '
297297
output &&
298298
test_i18ngrep "file1" output &&
299299
test_path_is_missing .git/rebase-merge &&
300+
rm file1 &&
300301
git reset --hard HEAD^
301302
'
302303

t/t3435-rebase-gpg-sign.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ test_rebase_gpg_sign ! true -i --gpg-sign --no-gpg-sign
6565
test_rebase_gpg_sign false -i --no-gpg-sign --gpg-sign
6666

6767
test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
68+
test_when_finished "git clean -f" &&
6869
git reset --hard merged &&
6970
git config commit.gpgsign true &&
7071
git rebase -p --no-gpg-sign --onto=one fork-point main &&

t/t3510-cherry-pick-sequence.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ test_expect_success 'allow skipping commit but not abort for a new history' '
238238
'
239239

240240
test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
241+
test_when_finished "rm unrelated" &&
241242
pristine_detach initial &&
242243
git rm --cached unrelated &&
243244
git commit -m "untrack unrelated" &&

t/t5304-prune.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ test_expect_success 'prune: handle HEAD reflog in multiple worktrees' '
291291
cat ../expected >blob &&
292292
git add blob &&
293293
git commit -m "second commit in third" &&
294+
git clean -f && # Remove untracked left behind by deleting index
294295
git reset --hard HEAD^
295296
) &&
296297
git prune --expire=now &&

t/t6415-merge-dir-to-symlink.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ test_expect_success 'checkout does not clobber untracked symlink' '
2525
git reset --hard main &&
2626
git rm --cached a/b &&
2727
git commit -m "untracked symlink remains" &&
28-
test_must_fail git checkout start^0
28+
test_must_fail git checkout start^0 &&
29+
git clean -fd # Do not leave the untracked symlink in the way
2930
'
3031

3132
test_expect_success 'a/b-2/c/d is kept when clobbering symlink b' '
@@ -34,7 +35,8 @@ test_expect_success 'a/b-2/c/d is kept when clobbering symlink b' '
3435
git rm --cached a/b &&
3536
git commit -m "untracked symlink remains" &&
3637
git checkout -f start^0 &&
37-
test_path_is_file a/b-2/c/d
38+
test_path_is_file a/b-2/c/d &&
39+
git clean -fd # Do not leave the untracked symlink in the way
3840
'
3941

4042
test_expect_success 'checkout should not have deleted a/b-2/c/d' '

t/t6424-merge-unrelated-index-changes.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ test_expect_success 'merge-recursive, when index==head but head!=HEAD' '
132132
133133
# Make index match B
134134
git diff C B -- | git apply --cached &&
135+
test_when_finished "git clean -fd" && # Do not leave untracked around
135136
# Merge B & F, with B as "head"
136137
git merge-recursive A -- B F > out &&
137138
test_i18ngrep "Already up to date" out

t/t6430-merge-recursive.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,9 @@ test_expect_success 'merge-recursive remembers the names of all base trees' '
718718
# merge-recursive prints in reverse order, but we do not care
719719
sort <trees >expect &&
720720
sed -n "s/^virtual //p" out | sort >actual &&
721-
test_cmp expect actual
721+
test_cmp expect actual &&
722+
723+
git clean -fd
722724
'
723725

724726
test_expect_success 'merge-recursive internal merge resolves to the sameness' '

t/t6436-merge-overwrite.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ test_expect_success 'will not overwrite removed file' '
6868
git commit -m "rm c1.c" &&
6969
cp important c1.c &&
7070
test_must_fail git merge c1a &&
71-
test_cmp important c1.c
71+
test_cmp important c1.c &&
72+
rm c1.c # Do not leave untracked file in way of future tests
7273
'
7374

7475
test_expect_success 'will not overwrite re-added file' '

0 commit comments

Comments
 (0)