From: Jeff King <peff@peff.net>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
Denton Liu <liu.denton@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern
Date: Fri, 9 Oct 2020 07:53:35 -0400 [thread overview]
Message-ID: <20201009115335.GA2855114@coredump.intra.peff.net> (raw)
In-Reply-To: <874kn3rfxy.fsf@igel.home>
On Fri, Oct 09, 2020 at 09:55:53AM +0200, Andreas Schwab wrote:
> >> > search_merges () {
> >> > git rev-list --all --grep="Merge branch '$1'" \
> >> > --pretty=tformat:"%P %s" |
> >> > - sed -ne "/^$_x40 \($_x40\) Merge .*/ {s//\1/p;$early_exit}"
> >> > + sed -ne "/^$oid_pattern \($oid_pattern\) Merge .*/ {s//\1/p;$early_exit}"
> [...]
> I wonder why --pretty uses %s when it is filtered out again anyway?
> (There is also a duplicate --all.)
It does confirm that the commit in question is a (likely) merge commit,
and not one that happens to have "Merge branch 'foo'" in the body, which
the earlier --grep would have hit. But it doesn't actually check for
'foo' in the sed match, so it would be fooled by a commit message like:
Merge branch 'bar'
* bar:
Merge branch 'foo'
If we wanted to tighten that up, then sed should match the branch name.
If we're willing to accept the looseness, the whole thing could probably
be:
git rev-list --all --grep="Merge branch '$1'" \
--min-parents 2 --parents ${early_exit:-"-1"} |
awk '{print $3}'
I'm happy either way, but I'm not sure anybody overly cares. Let's not
derail Denton's actual fix to make the script work in a sha256 world.
-Peff
prev parent reply other threads:[~2020-10-09 11:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 6:44 [PATCH 0/2] contrib/git-resurrect.sh: make it hash-agnostic Denton Liu
2020-10-08 6:44 ` [PATCH 1/2] contrib/git-resurrect.sh: indent with tabs Denton Liu
2020-10-08 17:32 ` Junio C Hamano
2020-10-08 18:48 ` Junio C Hamano
2020-10-08 6:44 ` [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern Denton Liu
2020-10-08 16:13 ` Jeff King
2020-10-08 18:29 ` Junio C Hamano
2020-10-08 19:53 ` Jeff King
2020-10-08 22:11 ` brian m. carlson
2020-10-09 7:55 ` Andreas Schwab
2020-10-09 11:53 ` Jeff King [this message]
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=20201009115335.GA2855114@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=liu.denton@gmail.com \
--cc=sandals@crustytoothpaste.net \
--cc=schwab@linux-m68k.org \
/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).