[PATCH 1/1] log: ensure diffs are omitted with --oneline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently when `git log --oneline` is invoked with the -L flag, the
full diffs are displayed along with the single line commit message.
It appears that within the log_tree_commit() function, the special
case that executes when opt->line_level_traverse is enabled (as in
the case when -L is provided) doesn't respect the --oneline option.

Ensure the --oneline option is respected by explicitly setting
DIFF_FORMAT_NO_OUTPUT if required.

Signed-off-by: James Liu <james@xxxxxxxxxxx>
---
 builtin/log.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/builtin/log.c b/builtin/log.c
index e5da0d1043..dd77ede00c 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -279,6 +279,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 		rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
 	argc = setup_revisions(argc, argv, rev, opt);
 
+	/* Ensure that we don't output diffs if the --oneline flag is provided */
+	if (rev->commit_format == CMIT_FMT_ONELINE)
+		rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
+
 	/* Any arguments at this point are not recognized */
 	if (argc > 1)
 		die(_("unrecognized argument: %s"), argv[1]);
-- 
2.43.2





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux