summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:20:35 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:20:36 -0700
commit9d21a968b2018983fa28a3e41dcb1d7546e0c27c (patch)
tree150d346d126a89fb62b8aa60509139ae6d146905 /t
parentPrepare for 2.13.3 (diff)
parentreflog-walk: include all fields when freeing complete_reflogs (diff)
downloadtgif-9d21a968b2018983fa28a3e41dcb1d7546e0c27c.tar.xz
Merge branch 'jk/reflog-walk-maint' into maint
After "git branch --move" of the currently checked out branch, the code to walk the reflog of HEAD via "log -g" and friends incorrectly stopped at the reflog entry that records the renaming of the branch. * jk/reflog-walk-maint: reflog-walk: include all fields when freeing complete_reflogs reflog-walk: don't free reflogs added to cache reflog-walk: duplicate strings in complete_reflogs list reflog-walk: skip over double-null oid due to HEAD rename
Diffstat (limited to 't')
-rwxr-xr-xt/t1411-reflog-show.sh10
-rwxr-xr-xt/t3200-branch.sh11
2 files changed, 21 insertions, 0 deletions
diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh
index 6ac7734d79..b9cb76654b 100755
--- a/t/t1411-reflog-show.sh
+++ b/t/t1411-reflog-show.sh
@@ -171,4 +171,14 @@ test_expect_success 'reflog exists works' '
! git reflog exists refs/heads/nonexistent
'
+# The behavior with two reflogs is buggy and the output is in flux; for now
+# we're just checking that the program works at all without segfaulting.
+test_expect_success 'showing multiple reflogs works' '
+ git log -g HEAD HEAD >actual
+'
+
+test_expect_success 'showing multiple reflogs with an old date' '
+ git log -g HEAD@{1979-01-01} HEAD >actual
+'
+
test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 48d152b9a9..dd37ac47c5 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -162,6 +162,17 @@ test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD'
grep "^0\{40\}.*$msg$" .git/logs/HEAD
'
+test_expect_success 'resulting reflog can be shown by log -g' '
+ oid=$(git rev-parse HEAD) &&
+ cat >expect <<-EOF &&
+ HEAD@{0} $oid $msg
+ HEAD@{1} $oid $msg
+ HEAD@{2} $oid checkout: moving from foo to baz
+ EOF
+ git log -g --format="%gd %H %gs" -3 HEAD >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' '
git checkout master &&
git worktree add -b baz bazdir &&