354
'
355
356
test_expect_success 'set up for querying the reflog' '
357
+ git update-ref -d $m &&
358
+ test-tool ref-store main delete-reflog $m &&
359
+
360
+ GIT_COMMITTER_DATE="1117150320 -0500" git update-ref $m $C &&
361
+ GIT_COMMITTER_DATE="1117150350 -0500" git update-ref $m $A &&
362
+ GIT_COMMITTER_DATE="1117150380 -0500" git update-ref $m $B &&
363
+ GIT_COMMITTER_DATE="1117150680 -0500" git update-ref $m $F &&
364
+ GIT_COMMITTER_DATE="1117150980 -0500" git update-ref $m $E &&
365
git update-ref $m $D &&
358
- cat >.git/logs/$m <<-EOF
366
+ # Delete the last reflog entry so that the tip of m and the reflog for
367
+ # it disagree.
368
+ git reflog delete $m@{0} &&
369
+
370
+ cat >expect <<-EOF &&
371
$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
372
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
373
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
362
- $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
363
- $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
374
+ $B $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
375
+ $F $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
376
EOF
377
+ test-tool ref-store main for-each-reflog-ent $m >actual &&
378
+ test_cmp expect actual
379
'
380
381
ed="Thu, 26 May 2005 18:32:00 -0500"
423
test_when_finished "rm -f o e" &&
424
git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
425
echo "$B" >expect &&
412
- test_cmp expect o &&
413
- test_grep -F "warning: log for ref $m has gap after $gd" e
426
+ test_cmp expect o
427
'
428
test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
429
test_when_finished "rm -f o e" &&
430
git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
418
- echo "$Z" >expect &&
431
+ echo "$F" >expect &&
432
test_cmp expect o &&
433
test_must_be_empty e
434
'
449
450
rm -f .git/$m .git/logs/$m expect
451
452
+test_expect_success REFFILES 'query reflog with gap' '
453
+ test_when_finished "git update-ref -d $m" &&
454
+
455
+ git update-ref $m $F &&
456
+ cat >.git/logs/$m <<-EOF &&
457
+ $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
458
+ $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
459
+ $D $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
460
+ EOF
461
+
462
+ git rev-parse --verify "main@{2005-05-26 23:33:01}" >actual 2>stderr &&
463
+ echo "$B" >expect &&
464
+ test_cmp expect actual &&
465
+ test_grep -F "warning: log for ref $m has gap after $gd" stderr
466
+'
467
+
468
test_expect_success 'creating initial files' '
469
test_when_finished rm -f M &&
470
echo TEST >F &&