Skip to content

Commit 0c89f71

Browse files
derrickstoleegitster
authored andcommitted
test-reach: test reduce_heads
Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 324dec0 commit 0c89f71

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

t/helper/test-reach.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ int cmd__reach(int ac, const char **av)
102102
struct commit_list *list = get_merge_bases_many(A, X_nr, X_array);
103103
printf("%s(A,X):\n", av[1]);
104104
print_sorted_commit_ids(list);
105+
} else if (!strcmp(av[1], "reduce_heads")) {
106+
struct commit_list *list = reduce_heads(X);
107+
printf("%s(X):\n", av[1]);
108+
print_sorted_commit_ids(list);
105109
}
106110

107111
exit(0);

t/t6600-test-reach.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,26 @@ test_expect_success 'get_merge_bases_many' '
138138
test_three_modes get_merge_bases_many
139139
'
140140

141+
test_expect_success 'reduce_heads' '
142+
cat >input <<-\EOF &&
143+
X:commit-1-10
144+
X:commit-2-8
145+
X:commit-3-6
146+
X:commit-4-4
147+
X:commit-1-7
148+
X:commit-2-5
149+
X:commit-3-3
150+
X:commit-5-1
151+
EOF
152+
{
153+
echo "reduce_heads(X):" &&
154+
git rev-parse commit-5-1 \
155+
commit-4-4 \
156+
commit-3-6 \
157+
commit-2-8 \
158+
commit-1-10 | sort
159+
} >expect &&
160+
test_three_modes reduce_heads
161+
'
162+
141163
test_done

0 commit comments

Comments
 (0)