From: Junio C Hamano <gitster@pobox.com>
To: James Liu <james@jamesliu.io>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/1] log: make the --oneline option work with -L
Date: Wed, 13 Mar 2024 10:31:25 -0700 [thread overview]
Message-ID: <xmqqr0geca36.fsf@gitster.g> (raw)
In-Reply-To: <20240313090841.36717-1-james@jamesliu.io> (James Liu's message of "Wed, 13 Mar 2024 20:08:40 +1100")
James Liu <james@jamesliu.io> writes:
> 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.
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).
So, just like "git log -L <range>:<file>" shows the commit log for
each commit that touches the specified area of the file, followed by
the diff that shows how the commit modified the range, it is natural
to expect "git log --oneline -L <range>:<file>" to show the same diff
after showing the commit log for these commits in the specified format,
namely, with just a one-line description.
It is not limited to "-L"; "git log --oneline -p" is expected to
show the patch after a one-line description for the commit.
next prev parent reply other threads:[~2024-03-13 17:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 9:08 [PATCH 0/1] log: make the --oneline option work with -L James Liu
2024-03-13 9:08 ` [PATCH 1/1] log: ensure diffs are omitted with --oneline James Liu
2024-03-13 17:31 ` Junio C Hamano [this message]
2024-03-13 18:08 ` [PATCH 0/1] log: make the --oneline option work with -L Beat Bolli
2024-03-13 22:25 ` James Liu
2024-03-13 22:24 ` James Liu
2024-03-13 22:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr0geca36.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=james@jamesliu.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).