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

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

From
James Liu <james@jamesliu.io>
Date
Mar 13, 2024, 09:08 UTC
Message-ID
<20240313090841.36717-1-james@jamesliu.io>
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(+)
-- 
2.43.2
Next: James Liu
Message 1 of 7 in “log: make the --oneline option work with -L”
  1. 0/1 log: make the --oneline option work with -LJames Liu, Mar 13, 2024
  2. 1/1 log: ensure diffs are omitted with --onelineJames Liu, Mar 13, 2024
  3. Junio C HamanoMar 13, 2024
  4. Beat BolliMar 13, 2024
  5. James LiuMar 13, 2024
  6. James LiuMar 13, 2024
  7. Junio C HamanoMar 13, 2024

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.