git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] revision: Turn off history simplification in --ancestry-path mode

From
Johan Herland <johan@herland.net>
Date
Jun 3, 2010, 23:17 UTC
Message-ID
<1275607057-26645-6-git-send-email-johan@herland.net>
In-Reply-To
<1275607057-26645-1-git-send-email-johan@herland.net>

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>
---
 revision.c                        |    1 +
 t/t6019-rev-list-ancestry-path.sh |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/revision.c b/revision.c
index 7eeadb4..3f95680 100644
--- a/revision.c
+++ b/revision.c
@@ -1194,6 +1194,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);
diff --git a/t/t6019-rev-list-ancestry-path.sh b/t/t6019-rev-list-ancestry-path.sh
index 0230724..7641029 100755
--- a/t/t6019-rev-list-ancestry-path.sh
+++ b/t/t6019-rev-list-ancestry-path.sh
@@ -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

@@ -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
--
1.7.0.4
Previous: Johan Herland
Message 6 of 6 in “revision: --ancestry-path, take 2”
  1. 0/5 revision: --ancestry-path, take 2Johan Herland, Jun 3, 2010
  2. 1/5 Documentation/rev-list-options.txt: Fix missing line in example history graphJohan Herland, Jun 3, 2010
  3. 2/5 revision: --ancestry-pathJohan Herland, Jun 3, 2010
  4. 3/5 Documentation/rev-list-options.txt: Explain --ancestry-pathJohan Herland, Jun 3, 2010
  5. 4/5 revision: Fix typo in --ancestry-path error messageJohan Herland, Jun 3, 2010
  6. 5/5 revision: Turn off history simplification in --ancestry-path modeJohan Herland, Jun 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.