From: Torstein Hegge <hegge@resisty.net>
To: git@vger.kernel.org
Cc: Torstein Hegge <hegge@resisty.net>
Subject: [PATCH] reflog: handle lightweight and annotated tags equally
Date: Sun, 27 Oct 2013 10:57:04 +0100 [thread overview]
Message-ID: <1382867824-23540-1-git-send-email-hegge@resisty.net> (raw)
When 'git reflog <tag>' is called on a lightweight tag, nothing is
output. However, when called on an annotated tag, shortened SHA-1s for
all reachable commits are written on a single line.
Teach add_pending_object_with_mode() to handle OBJ_TAG, so that 'git
reflog' on an annotated tag is quiet, like it is for lightweight tags,
commits and blobs.
Signed-off-by: Torstein Hegge <hegge@resisty.net>
---
Try 'GIT_PAGER=cat git reflog v1.8.4' on git.git to see an example of
this rather unexpected behavior.
revision.c | 2 +-
t/t1411-reflog-show.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/revision.c b/revision.c
index 0173e01..fa4e660 100644
--- a/revision.c
+++ b/revision.c
@@ -198,7 +198,7 @@ static void add_pending_object_with_mode(struct rev_info *revs,
return;
if (revs->no_walk && (obj->flags & UNINTERESTING))
revs->no_walk = 0;
- if (revs->reflog_info && obj->type == OBJ_COMMIT) {
+ if (revs->reflog_info) {
struct strbuf buf = STRBUF_INIT;
int len = interpret_branch_name(name, 0, &buf);
int st;
diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh
index 6f47c0d..de9fb8d 100755
--- a/t/t1411-reflog-show.sh
+++ b/t/t1411-reflog-show.sh
@@ -166,4 +166,32 @@ test_expect_success 'git log -g -p shows diffs vs. parents' '
test_cmp expect actual
'
+test_expect_success 'add annotated tag' '
+ git tag -a -m "tag message" annotated-tag
+'
+
+: >expect
+test_expect_success 'reflog on a tag' '
+ git reflog two >actual &&
+ test_cmp expect actual
+'
+
+: >expect
+test_expect_success 'reflog on an annotated tag' '
+ git reflog annotated-tag >actual &&
+ test_cmp expect actual
+'
+
+: >expect
+test_expect_success 'log -g on a tag' '
+ git log -g two >actual &&
+ test_cmp expect actual
+'
+
+: >expect
+test_expect_success 'log -g on an annotated tag' '
+ git log -g annotated-tag >actual &&
+ test_cmp expect actual
+'
+
test_done
--
1.8.4.1.808.g053d237
reply other threads:[~2013-10-27 12:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382867824-23540-1-git-send-email-hegge@resisty.net \
--to=hegge@resisty.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).