Skip to content

Commit

Permalink
Merge branch 'jk/maint-reflog-bottom' into maint
Browse files Browse the repository at this point in the history
* jk/maint-reflog-bottom:
  reflogs: clear flags properly in corner case
  • Loading branch information
gitster committed Dec 14, 2010
2 parents 37ad7ca + ffa1eea commit 006f424
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
1 change: 0 additions & 1 deletion reflog-walk.c
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion revision.c
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions t/t1412-reflog-loop.sh
@@ -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

0 comments on commit 006f424

Please sign in to comment.