Skip to content

Commit

Permalink
revision: Turn off history simplification in --ancestry-path mode
Browse files Browse the repository at this point in the history
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 <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johan Herland authored and Junio C Hamano committed Jun 6, 2010
1 parent 97b03c3 commit cb7529e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->first_parent_only = 1;
} else if (!strcmp(arg, "--ancestry-path")) {
revs->ancestry_path = 1;
revs->simplify_history = 0;
revs->limited = 1;
} else if (!strcmp(arg, "-g") || !strcmp(arg, "--walk-reflogs")) {
init_reflog_walk(&revs->reflog_info);
Expand Down
17 changes: 17 additions & 0 deletions t/t6019-rev-list-ancestry-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ test_description='--ancestry-path'
#
# D..M == E F G H I J K L M
# --ancestry-path D..M == E F H I J L M
#
# D..M -- M.t == M
# --ancestry-path D..M -- M.t == M

. ./test-lib.sh

Expand Down Expand Up @@ -53,4 +56,18 @@ test_expect_success 'rev-list --ancestry-path D..M' '
test_cmp expect actual
'

test_expect_success 'rev-list D..M -- M.t' '
echo M >expect &&
git rev-list --format=%s D..M -- M.t |
sed -e "/^commit /d" >actual &&
test_cmp expect actual
'

test_expect_success 'rev-list --ancestry-patch D..M -- M.t' '
echo M >expect &&
git rev-list --ancestry-path --format=%s D..M -- M.t |
sed -e "/^commit /d" >actual &&
test_cmp expect actual
'

test_done

0 comments on commit cb7529e

Please sign in to comment.