{"thread":{"id":"35217","subject":"[PATCH] reflog: handle lightweight and annotated tags equally","startedAt":"2013-10-27T09:57:04Z","lastAt":"2013-10-27T09:57:04Z","messageCount":1,"participants":["Torstein Hegge"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"229612","messageId":"1382867824-23540-1-git-send-email-hegge@resisty.net","threadId":"35217","inReplyTo":null,"subject":"[PATCH] reflog: handle lightweight and annotated tags equally","fromName":"Torstein Hegge","fromEmail":"hegge@resisty.net","sentAt":"2013-10-27T09:57:04Z","receivedAt":"2013-10-27T09:57:04Z","isPatch":true,"sender":{"key":"hegge@resisty.net","avatar":"https://avatars.githubusercontent.com/u/26041?v=4"},"body":"When 'git reflog <tag>' is called on a lightweight tag, nothing is\noutput. However, when called on an annotated tag, shortened SHA-1s for\nall reachable commits are written on a single line.\n\nTeach add_pending_object_with_mode() to handle OBJ_TAG, so that 'git\nreflog' on an annotated tag is quiet, like it is for lightweight tags,\ncommits and blobs.\n\nSigned-off-by: Torstein Hegge <hegge@resisty.net>\n---\nTry 'GIT_PAGER=cat git reflog v1.8.4' on git.git to see an example of\nthis rather unexpected behavior.\n\n revision.c             |  2 +-\n t/t1411-reflog-show.sh | 28 ++++++++++++++++++++++++++++\n 2 files changed, 29 insertions(+), 1 deletion(-)\n\ndiff --git a/revision.c b/revision.c\nindex 0173e01..fa4e660 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -198,7 +198,7 @@ static void add_pending_object_with_mode(struct rev_info *revs,\n \t\treturn;\n \tif (revs->no_walk && (obj->flags & UNINTERESTING))\n \t\trevs->no_walk = 0;\n-\tif (revs->reflog_info && obj->type == OBJ_COMMIT) {\n+\tif (revs->reflog_info) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tint len = interpret_branch_name(name, 0, &buf);\n \t\tint st;\ndiff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh\nindex 6f47c0d..de9fb8d 100755\n--- a/t/t1411-reflog-show.sh\n+++ b/t/t1411-reflog-show.sh\n@@ -166,4 +166,32 @@ test_expect_success 'git log -g -p shows diffs vs. parents' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'add annotated tag' '\n+\tgit tag -a -m \"tag message\" annotated-tag\n+'\n+\n+: >expect\n+test_expect_success 'reflog on a tag' '\n+\tgit reflog two >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+: >expect\n+test_expect_success 'reflog on an annotated tag' '\n+\tgit reflog annotated-tag >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+: >expect\n+test_expect_success 'log -g on a tag' '\n+\tgit log -g two >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+: >expect\n+test_expect_success 'log -g on an annotated tag' '\n+\tgit log -g annotated-tag >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n1.8.4.1.808.g053d237\n"}]}