From: "Martin Ågren" <martin.agren@gmail.com>
To: Adam Dinwoodie <adam@dinwoodie.org>
Cc: Git Mailing List <git@vger.kernel.org>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Phil Hord <phil.hord@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] diff-options.txt: correct command syntax
Date: Mon, 3 Feb 2020 07:24:00 +0100 [thread overview]
Message-ID: <CAN0heSpDV2N2L4ukgdWxWJYJC1Hg9KYYkMC9MrqMGkuiv34AmQ@mail.gmail.com> (raw)
In-Reply-To: <20200202204739.GA24686@dinwoodie.org>
On Sun, 2 Feb 2020 at 21:47, Adam Dinwoodie <adam@dinwoodie.org> wrote:
> On Sunday 02 February 2020 at 08:45 pm +0100, Martin Ågren wrote:
> > On Sun, 2 Feb 2020 at 20:24, Adam Dinwoodie <adam@dinwoodie.org> wrote:
>
> Ah, thank you! I had completely misread what these examples were trying
> to achieve. I think your example (or indeed anything from a different
> domain) would have avoided me getting confused in the first place.
> Although I'm much less fussed now I realise the problem here was
> entirely my understanding rather than an error in the docs.
>
> > BTW, I wonder what "in the same file" tries to say -- my hunch is we
> > could drop those words without any loss of correctness or readability.
> > Would you agree?
>
> I think "in the same file" is meaningful here: as I understand it both
> forms would find a commit that removed a line from one file and added it
> back to a _different_ file, but only the -G form would pick it when
> removed and added lines are in the same file.
You're right, it is needed. At least the way the example is given now,
where there's some arbitrary amount of left-out context between the "+"
and the "-" line, it's necessary to limit that by saying that it's in
the same file. Because this is an example, we're allowed to make it as
concrete as we see fit. For example:
To illustrate the difference between `-S<regex> --pickaxe-regex` and
`-G<regex>`, consider a commit with the following diff:
+
----
- hit = !frotz(nitfol, mf2.ptr, 1, 0);
+ return !frotz(nitfol, two->ptr, 1, 0);
----
+
While `git log -G"frotz\(nitfol"` will show this commit, `git log
-S"frotz\(nitfol" --pickaxe-regex` will not (because the number of
occurrences of that string did not change).
Or does that make it too specific, i.e., could this give readers the
wrong impression that -G and/or -S and/or the difference explained here
only apply to such "trivial" cases?
Martin
next prev parent reply other threads:[~2020-02-03 6:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-02 19:22 [PATCH] diff-options.txt: correct command syntax Adam Dinwoodie
2020-02-02 19:45 ` Martin Ågren
2020-02-02 20:47 ` Adam Dinwoodie
2020-02-03 6:24 ` Martin Ågren [this message]
2020-02-06 20:53 ` [PATCH] diff-options.txt: avoid "regex" overload in example Martin Ågren
2020-02-08 23:24 ` Taylor Blau
2020-02-09 17:25 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN0heSpDV2N2L4ukgdWxWJYJC1Hg9KYYkMC9MrqMGkuiv34AmQ@mail.gmail.com \
--to=martin.agren@gmail.com \
--cc=adam@dinwoodie.org \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phil.hord@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).