test-reach: test reduce_heads
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
324dec0191
commit
0c89f715d0
@ -102,6 +102,10 @@ int cmd__reach(int ac, const char **av)
|
|||||||
struct commit_list *list = get_merge_bases_many(A, X_nr, X_array);
|
struct commit_list *list = get_merge_bases_many(A, X_nr, X_array);
|
||||||
printf("%s(A,X):\n", av[1]);
|
printf("%s(A,X):\n", av[1]);
|
||||||
print_sorted_commit_ids(list);
|
print_sorted_commit_ids(list);
|
||||||
|
} else if (!strcmp(av[1], "reduce_heads")) {
|
||||||
|
struct commit_list *list = reduce_heads(X);
|
||||||
|
printf("%s(X):\n", av[1]);
|
||||||
|
print_sorted_commit_ids(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -138,4 +138,26 @@ test_expect_success 'get_merge_bases_many' '
|
|||||||
test_three_modes get_merge_bases_many
|
test_three_modes get_merge_bases_many
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'reduce_heads' '
|
||||||
|
cat >input <<-\EOF &&
|
||||||
|
X:commit-1-10
|
||||||
|
X:commit-2-8
|
||||||
|
X:commit-3-6
|
||||||
|
X:commit-4-4
|
||||||
|
X:commit-1-7
|
||||||
|
X:commit-2-5
|
||||||
|
X:commit-3-3
|
||||||
|
X:commit-5-1
|
||||||
|
EOF
|
||||||
|
{
|
||||||
|
echo "reduce_heads(X):" &&
|
||||||
|
git rev-parse commit-5-1 \
|
||||||
|
commit-4-4 \
|
||||||
|
commit-3-6 \
|
||||||
|
commit-2-8 \
|
||||||
|
commit-1-10 | sort
|
||||||
|
} >expect &&
|
||||||
|
test_three_modes reduce_heads
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user