Skip to content

Commit 38881a9

Browse files
pietergitster
authored andcommitted
reflog test: add more tests for 'reflog delete'
This adds more tests for 'reflog delete' and marks it as broken, as currently a call to 'git reflog delete HEAD@{1}' deletes entries in the currently checked out branch's log, not the HEAD log. Noticed by John Wiegley Signed-off-by: Pieter de Bie <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18a2197 commit 38881a9

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

t/t1410-reflog.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ test_expect_success 'recover and check' '
175175
176176
'
177177

178-
test_expect_success 'delete' '
178+
test_expect_failure 'delete' '
179179
echo 1 > C &&
180180
test_tick &&
181181
git commit -m rat C &&
@@ -188,16 +188,30 @@ test_expect_success 'delete' '
188188
test_tick &&
189189
git commit -m tiger C &&
190190
191-
test 5 = $(git reflog | wc -l) &&
191+
HEAD_entry_count=$(git reflog | wc -l)
192+
master_entry_count=$(git reflog show master | wc -l)
193+
194+
test $HEAD_entry_count = 5 &&
195+
test $master_entry_count = 5 &&
196+
192197
193198
git reflog delete master@{1} &&
194199
git reflog show master > output &&
195-
test 4 = $(wc -l < output) &&
200+
test $(($master_entry_count - 1)) = $(wc -l < output) &&
201+
test $HEAD_entry_count = $(git reflog | wc -l) &&
196202
! grep ox < output &&
197203
204+
master_entry_count=$(wc -l < output)
205+
206+
git reflog delete HEAD@{1} &&
207+
test $(($HEAD_entry_count -1)) = $(git reflog | wc -l) &&
208+
test $master_entry_count = $(git reflog show master | wc -l) &&
209+
210+
HEAD_entry_count=$(git reflog | wc -l)
211+
198212
git reflog delete master@{07.04.2005.15:15:00.-0700} &&
199213
git reflog show master > output &&
200-
test 3 = $(wc -l < output) &&
214+
test $(($master_entry_count - 1)) = $(wc -l < output) &&
201215
! grep dragon < output
202216
203217
'

0 commit comments

Comments
 (0)