Skip to content

Commit 006f424

Browse files
committed
Merge branch 'jk/maint-reflog-bottom' into maint
* jk/maint-reflog-bottom: reflogs: clear flags properly in corner case
2 parents 37ad7ca + ffa1eea commit 006f424

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

reflog-walk.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
239239

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

245244
void get_reflog_selector(struct strbuf *sb,

revision.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,8 +2030,10 @@ static struct commit *get_revision_1(struct rev_info *revs)
20302030
revs->commits = entry->next;
20312031
free(entry);
20322032

2033-
if (revs->reflog_info)
2033+
if (revs->reflog_info) {
20342034
fake_reflog_parent(revs->reflog_info, commit);
2035+
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
2036+
}
20352037

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

t/t1412-reflog-loop.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
test_description='reflog walk shows repeated commits again'
4+
. ./test-lib.sh
5+
6+
test_expect_success 'setup commits' '
7+
test_tick &&
8+
echo content >file && git add file && git commit -m one &&
9+
git tag one &&
10+
echo content >>file && git add file && git commit -m two &&
11+
git tag two
12+
'
13+
14+
test_expect_success 'setup reflog with alternating commits' '
15+
git checkout -b topic &&
16+
git reset one &&
17+
git reset two &&
18+
git reset one &&
19+
git reset two
20+
'
21+
22+
test_expect_success 'reflog shows all entries' '
23+
cat >expect <<-\EOF
24+
topic@{0} two: updating HEAD
25+
topic@{1} one: updating HEAD
26+
topic@{2} two: updating HEAD
27+
topic@{3} one: updating HEAD
28+
topic@{4} branch: Created from HEAD
29+
EOF
30+
git log -g --format="%gd %gs" topic >actual &&
31+
test_cmp expect actual
32+
'
33+
34+
test_done

0 commit comments

Comments
 (0)