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

[PATCH 1/1] revision.c: use new topo-order logic in tests

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 19, 2018, 19:03 UTC
Message-ID
<ab7c2dd46fb72523b865ecf34204c7ae31dee416.1542654209.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.83.git.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>

The revision-walk machinery is being rewritten to use generation numbers in the commit-graph when availble. Due to some problematic commit histories, the new logic can be slower than the previous method due to how commit dates and generation numbers interact. Thus, the new logic is not used in comparison queries, such as

	git log --topo-order A..B

The logic for these queries was implemented during the refactor, but is unreachable due to the potential performance penalty. The code came along with a larger block of code that was copied from the old code. When generation numbers are updated to v2 (corrected commit dates), then we will no longer have a performance penalty and this logic is what we will want to use.

In the meantime, use the new logic when GIT_TEST_COMMIT_GRAPH is enabled. This will demonstrate that the new logic works for all comparison queries in the test suite, including these variants:

	git log --topo-order --ancestry-path A..B
	git log --topo-order A...B
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 revision.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/revision.c b/revision.c
index 4ef47d2fb4..d52da6e24f 100644
--- a/revision.c
+++ b/revision.c
@@ -27,6 +27,7 @@
 #include "commit-reach.h"
 #include "commit-graph.h"
 #include "prio-queue.h"
+#include "config.h"
 
 volatile show_early_output_fn_t show_early_output;
 
@@ -3143,6 +3144,9 @@ int prepare_revision_walk(struct rev_info *revs)
 		commit_list_sort_by_date(&revs->commits);
 	if (revs->no_walk)
 		return 0;
+	if (revs->limited &&
+	    git_env_bool(GIT_TEST_COMMIT_GRAPH, 0))
+		revs->limited = 0;
 	if (revs->limited) {
 		if (limit_list(revs) < 0)
 			return -1;
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Junio C Hamano
Message 2 of 4 in “Use new topo-order logic with GIT_TEST_COMMIT_GRAPH”
  1. 0/1 Use new topo-order logic with GIT_TEST_COMMIT_GRAPHDerrick Stolee via GitGitGadget, Nov 19, 2018
  2. 1/1 revision.c: use new topo-order logic in testsDerrick Stolee via GitGitGadget, Nov 19, 2018
  3. Junio C HamanoNov 20, 2018
  4. Derrick StoleeNov 20, 2018

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.