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

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

From
James Liu <james@jamesliu.io>
Date
Mar 13, 2024, 22:24 UTC
Message-ID
<CZSZ38DTWF14.3BNXFKTGVPLZQ@jamesliu.io>
In-Reply-To
<xmqqr0geca36.fsf@gitster.g>
On Thu Mar 14, 2024 at 4:31 AM AEDT, Junio C Hamano wrote:
Show 22 quoted lines
> James Liu <james@jamesliu.io> writes:
>
> > 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.
>
> Why is it incorrect?
>
>  * "git log" takes options to tweak formatting of the commit log,
>    options to tweak what commits are chosen, and options to tweak
>    how the diff are shown.
>
>  * "--oneline" tweaks how the log message gets shown.  Others in the
>    family are --pretty=fuller, --format='%h %s', etc.
>
>  * "-L" tweaks how the diff gets shown (e.g. limits which part of
>    the diff is shown) and what commits are shown (e.g. limits to
>    commits that touch the specified area).

I suppose it isn't intuitive to me which options affect how the commits are presented, and which affect the diffs. The help entry for -L states that it will "Trace the evolution of the line range", which doesn't immediately suggest that it tweaks how the log message is shown. As a user of this option, I'm more interested in using it as a filter for how commits are chosen.

-S feels like a similar option to -L, but will omit the diff when used with --oneline. I think I was probably experimenting with "--oneline -S" and then was surprised to see diffs after trying "--oneline -L".

Previous: James LiuNext: Junio C Hamano
Message 6 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.