Message ID | 20240313090841.36717-2-james@jamesliu.io (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | log: make the --oneline option work with -L | expand |
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]);
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@jamesliu.io> --- builtin/log.c | 4 ++++ 1 file changed, 4 insertions(+)