Browse Source

Merge branch 'jk/maint-reflog-bottom' into maint

* jk/maint-reflog-bottom:
  reflogs: clear flags properly in corner case
maint
Junio C Hamano 14 years ago
parent
commit
006f424b2d
  1. 1
      reflog-walk.c
  2. 4
      revision.c
  3. 34
      t/t1412-reflog-loop.sh

1
reflog-walk.c

@ -239,7 +239,6 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit) @@ -239,7 +239,6 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)

commit->parents = xcalloc(sizeof(struct commit_list), 1);
commit->parents->item = commit_info->commit;
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
}

void get_reflog_selector(struct strbuf *sb,

4
revision.c

@ -2030,8 +2030,10 @@ static struct commit *get_revision_1(struct rev_info *revs) @@ -2030,8 +2030,10 @@ static struct commit *get_revision_1(struct rev_info *revs)
revs->commits = entry->next;
free(entry);

if (revs->reflog_info)
if (revs->reflog_info) {
fake_reflog_parent(revs->reflog_info, commit);
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
}

/*
* If we haven't done the list limiting, we need to look at

34
t/t1412-reflog-loop.sh

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
#!/bin/sh

test_description='reflog walk shows repeated commits again'
. ./test-lib.sh

test_expect_success 'setup commits' '
test_tick &&
echo content >file && git add file && git commit -m one &&
git tag one &&
echo content >>file && git add file && git commit -m two &&
git tag two
'

test_expect_success 'setup reflog with alternating commits' '
git checkout -b topic &&
git reset one &&
git reset two &&
git reset one &&
git reset two
'

test_expect_success 'reflog shows all entries' '
cat >expect <<-\EOF
topic@{0} two: updating HEAD
topic@{1} one: updating HEAD
topic@{2} two: updating HEAD
topic@{3} one: updating HEAD
topic@{4} branch: Created from HEAD
EOF
git log -g --format="%gd %gs" topic >actual &&
test_cmp expect actual
'

test_done
Loading…
Cancel
Save