diff options
author | Torstein Hegge <hegge@resisty.net> | 2013-10-27 10:57:04 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-28 09:20:09 -0700 |
commit | 56cdf06f1960611a0bce3060ce4f836d0e2b73ea (patch) | |
tree | 1f452b678c3ab80f98f4e8c5f5cc780f772da633 | |
parent | 3fa366668a2cfee9abfa62701b5176acb316f169 (diff) | |
download | git-th/reflog-annotated-tag.tar.gz |
reflog: handle lightweight and annotated tags equallyth/reflog-annotated-tag
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | revision.c | 2 | ||||
-rwxr-xr-x | t/t1411-reflog-show.sh | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/revision.c b/revision.c index ac20d1aaed..be845cf84c 100644 --- a/revision.c +++ b/revision.c @@ -199,7 +199,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, &buf); int st; diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh index 6f47c0dd0e..de9fb8d94f 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 |