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

[PATCH v2 1/3] revision: move -L setup before output_format-to-diff derivation

From
Michael Montalbo via GitGitGadget <gitgitgadget@gmail.com>
Date
May 25, 2026, 19:40 UTC
Message-ID
<9633eb62c620c7935f4e0aa87cae8808a6128c26.1779738059.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2094.v2.git.1779738059.gitgitgadget@gmail.com>
From: Michael Montalbo <mmontalbo@gmail.com>

The line_level_traverse block sets a default DIFF_FORMAT_PATCH when no output format has been explicitly requested. This default must be visible to the "Did the user ask for any diff output?" check that derives revs->diff from revs->diffopt.output_format.

Currently the -L block runs after that derivation, so revs->diff stays 0 when no explicit format is given. This does not matter yet because log_tree_commit() short-circuits into line_log_print() before consulting revs->diff, but the next commit will route -L through the normal log_tree_diff() path, which checks revs->diff.

Move the block above the derivation so the default DIFF_FORMAT_PATCH is in place when revs->diff is computed. No behavior change on its own.

Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
---
 revision.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/revision.c b/revision.c
index 599b3a66c3..4a8e24bc38 100644
--- a/revision.c
+++ b/revision.c
@@ -3112,6 +3112,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 		object_context_release(&oc);
 	}
 
+	if (revs->line_level_traverse) {
+		if (want_ancestry(revs))
+			revs->limited = 1;
+		revs->topo_order = 1;
+		if (!revs->diffopt.output_format)
+			revs->diffopt.output_format = DIFF_FORMAT_PATCH;
+	}
+
 	/* Did the user ask for any diff output? Run the diff! */
 	if (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT)
 		revs->diff = 1;
@@ -3125,14 +3133,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 	if (revs->diffopt.objfind)
 		revs->simplify_history = 0;
 
-	if (revs->line_level_traverse) {
-		if (want_ancestry(revs))
-			revs->limited = 1;
-		revs->topo_order = 1;
-		if (!revs->diffopt.output_format)
-			revs->diffopt.output_format = DIFF_FORMAT_PATCH;
-	}
-
 	if (revs->topo_order && !generation_numbers_enabled(the_repository))
 		revs->limited = 1;
 
-- 
gitgitgadget
Previous: Michael Montalbo via GitGitGadgetNext: Michael Montalbo via GitGitGadget
Message 8 of 20 in “line-log: integrate -L with the standard log output pipeline”
  1. 0/3 line-log: integrate -L with the standard log output pipelineMichael Montalbo via GitGitGadget, Apr 28, 2026
  2. 1/3 revision: move -L setup before output_format-to-diff derivationMichael Montalbo via GitGitGadget, Apr 28, 2026
  3. 2/3 line-log: integrate -L output with the standard log-tree pipelineMichael Montalbo via GitGitGadget, Apr 28, 2026
  4. 3/3 line-log: allow non-patch diff formats with -LMichael Montalbo via GitGitGadget, Apr 28, 2026
  5. Junio C HamanoMay 12, 2026
  6. D. Ben KnobleMay 22, 2026
  7. 0/3 line-log: integrate -L with the standard log output pipelineMichael Montalbo via GitGitGadget, May 25, 2026
  8. 1/3 revision: move -L setup before output_format-to-diff derivationMichael Montalbo via GitGitGadget, May 25, 2026
  9. 2/3 line-log: integrate -L output with the standard log-tree pipelineMichael Montalbo via GitGitGadget, May 25, 2026
  10. 3/3 line-log: allow non-patch diff formats with -LMichael Montalbo via GitGitGadget, May 25, 2026
  11. D. Ben KnobleMay 27, 2026
  12. Junio C HamanoMay 28, 2026
  13. Michael MontalboMay 28, 2026
  14. 0/3 line-log: integrate -L with the standard log output pipelineMichael Montalbo via GitGitGadget, May 28, 2026
  15. 1/3 revision: move -L setup before output_format-to-diff derivationMichael Montalbo via GitGitGadget, May 28, 2026
  16. 2/3 line-log: integrate -L output with the standard log-tree pipelineMichael Montalbo via GitGitGadget, May 28, 2026
  17. 3/3 line-log: allow non-patch diff formats with -LMichael Montalbo via GitGitGadget, May 28, 2026
  18. Ben KnobleMay 29, 2026
  19. Junio C HamanoJun 1, 2026
  20. Michael MontalboMay 24, 2026

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.