Skip to content

Commit 016e5ff

Browse files
committed
war on "sleep" in tests
In many places in test suite we have "sleep"s that do not have to be there. - I do not simply see the point of the one in t3500. It may be making sure that the timestamp order of commits generated during the test is stable, in which case test_tick is the right ingredient to use without wasting tester's time. - The one in t4011 is to make sure that the plumbing diff-index notices the stat-dirtyness of a removed then identically recreated symlink. Keeping the old symlink around to make sure that a newly created symlink gets different ino would be sufficient for that purpose. - The one in t7600 is to make sure that "git merge" does not get confused by stat-dirty "file" in the working tree. Again, keeping the old file around and creating an identical copy to ensure a different ino would be sufficient for that purpose. The "racy git" tests in t0010 are inherently about mtime between the index itself and index entries. The "sleep" in that test must stay as they are. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 537f6c7 commit 016e5ff

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

t/t3500-cherry.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,27 @@ test_expect_success \
1717
'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
1818
'echo First > A &&
1919
git update-index --add A &&
20+
test_tick &&
2021
git commit -m "Add A." &&
2122
2223
git checkout -b my-topic-branch &&
2324
2425
echo Second > B &&
2526
git update-index --add B &&
27+
test_tick &&
2628
git commit -m "Add B." &&
2729
28-
sleep 2 &&
2930
echo AnotherSecond > C &&
3031
git update-index --add C &&
32+
test_tick &&
3133
git commit -m "Add C." &&
3234
3335
git checkout -f master &&
3436
rm -f B C &&
3537
3638
echo Third >> A &&
3739
git update-index A &&
40+
test_tick &&
3841
git commit -m "Modify A." &&
3942
4043
expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*"

t/t4011-diff-symlink.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ EOF
5454

5555
test_expect_success \
5656
'diff removed symlink' \
57-
'rm frotz &&
57+
'mv frotz frotz2 &&
5858
git diff-index -M -p $tree > current &&
5959
compare_diff_patch current expected'
6060

@@ -64,8 +64,7 @@ EOF
6464

6565
test_expect_success \
6666
'diff identical, but newly created symlink' \
67-
'sleep 3 &&
68-
ln -s xyzzy frotz &&
67+
'ln -s xyzzy frotz &&
6968
git diff-index -M -p $tree > current &&
7069
compare_diff_patch current expected'
7170

t/t7600-merge.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,7 @@ test_debug 'gitk --all'
554554

555555
test_expect_success 'refresh the index before merging' '
556556
git reset --hard c1 &&
557-
sleep 1 &&
558-
touch file &&
557+
cp file file.n && mv -f file.n file &&
559558
git merge c3
560559
'
561560

0 commit comments

Comments
 (0)