summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-27 22:58:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-27 22:58:21 (GMT)
commit7c3932334ef57e78f8cd170e3337f218646d7077 (patch)
tree2460d512738914b0934172df5264f07f27d6162c
parent103209c6782586d92b04ee1fc71c0fd6f6385f5f (diff)
parent105e47339794ec2c862338d7a25df77b7d72385e (diff)
downloadgit-7c3932334ef57e78f8cd170e3337f218646d7077.zip
git-7c3932334ef57e78f8cd170e3337f218646d7077.tar.gz
git-7c3932334ef57e78f8cd170e3337f218646d7077.tar.bz2
Merge branch 'jc/upstream-reflog'
* jc/upstream-reflog: Fix log -g this@{upstream}
-rw-r--r--revision.c18
-rwxr-xr-xt/t1507-rev-parse-upstream.sh29
2 files changed, 43 insertions, 4 deletions
diff --git a/revision.c b/revision.c
index f54d43f..3ba6d99 100644
--- a/revision.c
+++ b/revision.c
@@ -134,10 +134,20 @@ static void add_pending_object_with_mode(struct rev_info *revs, struct object *o
{
if (revs->no_walk && (obj->flags & UNINTERESTING))
revs->no_walk = 0;
- if (revs->reflog_info && obj->type == OBJ_COMMIT &&
- add_reflog_for_walk(revs->reflog_info,
- (struct commit *)obj, name))
- return;
+ if (revs->reflog_info && obj->type == OBJ_COMMIT) {
+ struct strbuf buf = STRBUF_INIT;
+ int len = interpret_branch_name(name, &buf);
+ int st;
+
+ if (0 < len && name[len] && buf.len)
+ strbuf_addstr(&buf, name + len);
+ st = add_reflog_for_walk(revs->reflog_info,
+ (struct commit *)obj,
+ buf.buf[0] ? buf.buf: name);
+ strbuf_release(&buf);
+ if (st)
+ return;
+ }
add_object_array_with_mode(obj, name, &revs->pending, mode);
}
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index 95c9b09..8c8dfda 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -107,4 +107,33 @@ test_expect_success 'checkout other@{u}' '
test_cmp expect actual
'
+cat >expect <<EOF
+commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5
+Reflog: master@{0} (C O Mitter <committer@example.com>)
+Reflog message: branch: Created from HEAD
+Author: A U Thor <author@example.com>
+Date: Thu Apr 7 15:15:13 2005 -0700
+
+ 3
+EOF
+test_expect_success 'log -g other@{u}' '
+ git log -1 -g other@{u} >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<EOF
+commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5
+Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <committer@example.com>)
+Reflog message: branch: Created from HEAD
+Author: A U Thor <author@example.com>
+Date: Thu Apr 7 15:15:13 2005 -0700
+
+ 3
+EOF
+
+test_expect_success 'log -g other@{u}@{now}' '
+ git log -1 -g other@{u}@{now} >actual &&
+ test_cmp expect actual
+'
+
test_done