Skip to content

log: make the --oneline option work with -L

James Liu git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1log: ensure diffs are omitted with --onelinebuiltin/log.c+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] log: make the --oneline option work with -L

Hey folks,

This is a small patch to fix an issue I've experienced with git-log(1) when certain combinations of flags are provided. This is also my very first patch submission, so I've tried to limit the blast radius as much as possible. I'm also unsure if this is the best place to implement the change, so any feedback is welcome!

I'd like to ideally add a test as well, but I'm unsure where this should slot in.

git-log accepts the --oneline option to display the short commit SHA and title only. This is a convenient option when searching through Git history, as it gives a rough idea of the changes introduced in each commit. git-log also accepts the -L flag, which lets us provide a line range for a given file. This is handy for limiting the search to a given area of interest.

However, when --oneline is used in combination with -L, Git actually outputs the single line commit information _as well_ as the full diff. For example:

        git log --oneline -L 660:Documentation/MyFirstObjectWalk.txt

will incorrectly display the diffs too.

This patch aims to fix this behaviour by respecting the --oneline option when used in conjunction with -L.

James Liu (1):
log: ensure diffs are omitted with --oneline

 builtin/log.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
2.43.2