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

[RFC PATCH 2/4] line-log: set patch format explicitly by default

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 9, 2023, 00:44 UTC
Message-ID
<20230509004406.1786033-3-felipe.contreras@gmail.com>
In-Reply-To
<20230509004406.1786033-1-felipe.contreras@gmail.com>
Will help further changes.
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/log.c | 5 +++++
 line-log.c    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/builtin/log.c b/builtin/log.c
index 4f162ff4d0..568207916b 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -889,6 +889,11 @@ int cmd_log(int argc, const char **argv, const char *prefix)
 	opt.revarg_opt = REVARG_COMMITTISH;
 	opt.tweak = log_setup_revisions_tweak;
 	cmd_log_init(argc, argv, prefix, &rev, &opt);
+
+	if (!rev.diffopt.output_format)
+		if (rev.line_level_traverse)
+			rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+
 	return cmd_log_deinit(cmd_log_walk(&rev), &rev);
 }
 
diff --git a/line-log.c b/line-log.c
index 10c19daec4..4499fd0c59 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1140,7 +1140,7 @@ int line_log_print(struct rev_info *rev, struct commit *commit)
 {
 
 	show_log(rev);
-	if (!(rev->diffopt.output_format & DIFF_FORMAT_NO_OUTPUT)) {
+	if (rev->diffopt.output_format & DIFF_FORMAT_PATCH) {
 		struct line_log_data *range = lookup_line_range(rev, commit);
 		dump_diff_hacky(rev, range);
 	}
-- 
2.40.0+fc1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 3 of 5 in “diff: fix default/no-output”
  1. 0/4 diff: fix default/no-outputFelipe Contreras, May 9, 2023
  2. 1/4 t4013: add expected failure for "log --patch --no-patch"Felipe Contreras, May 9, 2023
  3. 2/4 line-log: set patch format explicitly by defaultFelipe Contreras, May 9, 2023
  4. 3/4 diff: introduce DIFF_FORMAT_DEFAULTFelipe Contreras, May 9, 2023
  5. 4/4 diff: remove DIFF_FORMAT_NO_OUTPUTFelipe Contreras, May 9, 2023

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.