Skip to content

Commit cb7529e

Browse files
jherlandgitster
authored andcommitted
revision: Turn off history simplification in --ancestry-path mode
When using --ancestry-path together with history simplification (typically triggered by path limiting), history simplification would get in the way of --ancestry-path by prematurely removing the parent links between commits on which the ancestry path calculations are made. This patch disables this history simplification when --ancestry-path is enabled. This is similar to what e.g. --full-history already does. The patch also includes a simple testcase verifying that --ancestry-path works together with path limiting. Signed-off-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 97b03c3 commit cb7529e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

revision.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
11901190
revs->first_parent_only = 1;
11911191
} else if (!strcmp(arg, "--ancestry-path")) {
11921192
revs->ancestry_path = 1;
1193+
revs->simplify_history = 0;
11931194
revs->limited = 1;
11941195
} else if (!strcmp(arg, "-g") || !strcmp(arg, "--walk-reflogs")) {
11951196
init_reflog_walk(&revs->reflog_info);

t/t6019-rev-list-ancestry-path.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ test_description='--ancestry-path'
1010
#
1111
# D..M == E F G H I J K L M
1212
# --ancestry-path D..M == E F H I J L M
13+
#
14+
# D..M -- M.t == M
15+
# --ancestry-path D..M -- M.t == M
1316

1417
. ./test-lib.sh
1518

@@ -53,4 +56,18 @@ test_expect_success 'rev-list --ancestry-path D..M' '
5356
test_cmp expect actual
5457
'
5558

59+
test_expect_success 'rev-list D..M -- M.t' '
60+
echo M >expect &&
61+
git rev-list --format=%s D..M -- M.t |
62+
sed -e "/^commit /d" >actual &&
63+
test_cmp expect actual
64+
'
65+
66+
test_expect_success 'rev-list --ancestry-patch D..M -- M.t' '
67+
echo M >expect &&
68+
git rev-list --ancestry-path --format=%s D..M -- M.t |
69+
sed -e "/^commit /d" >actual &&
70+
test_cmp expect actual
71+
'
72+
5673
test_done

0 commit comments

Comments
 (0)