{"thread":{"id":"54369","subject":"[PATCH 1/2] contrib/git-resurrect.sh: indent with tabs","startedAt":"2020-10-08T06:44:52Z","lastAt":"2020-10-09T11:53:37Z","messageCount":11,"participants":["Denton Liu","Jeff King","Junio C Hamano","brian m. carlson","Andreas Schwab"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"407120","messageId":"5f5f1763043e80cbae6f9d4286aa5ba1960d32e0.1602139448.git.liu.denton@gmail.com","threadId":"54369","inReplyTo":"cover.1602139448.git.liu.denton@gmail.com","subject":"[PATCH 1/2] contrib/git-resurrect.sh: indent with tabs","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-10-08T06:44:39Z","receivedAt":"2020-10-08T06:44:52Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the git-resurrect script, there are a few lines that are mistakenly\nindented with spaces. Replace these lines with tabs.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/git-resurrect.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\nindex 8c171dd959..57a77c03f9 100755\n--- a/contrib/git-resurrect.sh\n+++ b/contrib/git-resurrect.sh\n@@ -27,7 +27,7 @@ n,dry-run            don't recreate the branch\"\n \n search_reflog () {\n \tsed -ne 's~^\\([^ ]*\\) .*\tcheckout: moving from '\"$1\"' .*~\\1~p' \\\n-                < \"$GIT_DIR\"/logs/HEAD\n+\t\t< \"$GIT_DIR\"/logs/HEAD\n }\n \n search_reflog_merges () {\n@@ -41,9 +41,9 @@ _x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n \n search_merges () {\n-        git rev-list --all --grep=\"Merge branch '$1'\" \\\n-                --pretty=tformat:\"%P %s\" |\n-        sed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n+\tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n+\t\t--pretty=tformat:\"%P %s\" |\n+\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n }\n \n search_merge_targets () {\n-- \n2.29.0.rc0.261.g7178c9af9c\n\n"},{"id":"407121","messageId":"cover.1602139448.git.liu.denton@gmail.com","threadId":"54369","inReplyTo":null,"subject":"[PATCH 0/2] contrib/git-resurrect.sh: make it hash-agnostic","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-10-08T06:44:38Z","receivedAt":"2020-10-08T06:44:52Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Since Git supports hashes other than SHA-1, the hardcoded $_x40 used to\nmatch OIDs is no longer correct. Replace it with a hash-agnostic\nversion.\n\nWhile we're at it fix some indent issues.\n\nThere are some other style issues in the script but I'll leave those as\nout-of-scope.\n\nDenton Liu (2):\n  contrib/git-resurrect.sh: indent with tabs\n  contrib/git-resurrect.sh: use hash-agnostic OID pattern\n\n contrib/git-resurrect.sh | 13 ++++++-------\n 1 file changed, 6 insertions(+), 7 deletions(-)\n\n-- \n2.29.0.rc0.261.g7178c9af9c\n\n"},{"id":"407122","messageId":"6fad1fc7fdad98c3dda1ec334a10a6a9e311fef8.1602139448.git.liu.denton@gmail.com","threadId":"54369","inReplyTo":"cover.1602139448.git.liu.denton@gmail.com","subject":"[PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-10-08T06:44:40Z","receivedAt":"2020-10-08T06:44:56Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Since Git now supports hashes other than SHA-1, the hash length isn't\nguaranteed to be 40 characters. Replace $_x40 with a hash-agnostic OID\npattern.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/git-resurrect.sh | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\nindex 57a77c03f9..d843df3afd 100755\n--- a/contrib/git-resurrect.sh\n+++ b/contrib/git-resurrect.sh\n@@ -37,19 +37,18 @@ search_reflog_merges () {\n \t)\n }\n \n-_x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n+oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g')\n \n search_merges () {\n \tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n \t\t--pretty=tformat:\"%P %s\" |\n-\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n+\tsed -ne \"/^$oid_pattern \\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit}\"\n }\n \n search_merge_targets () {\n \tgit rev-list --all --grep=\"Merge branch '[^']*' into $branch\\$\" \\\n \t\t--pretty=tformat:\"%H %s\" --all |\n-\tsed -ne \"/^\\($_x40\\) Merge .*/ {s//\\1/p;$early_exit} \"\n+\tsed -ne \"/^\\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit} \"\n }\n \n dry_run=\n-- \n2.29.0.rc0.261.g7178c9af9c\n\n"},{"id":"407163","messageId":"20201008161345.GD2823778@coredump.intra.peff.net","threadId":"54369","inReplyTo":"6fad1fc7fdad98c3dda1ec334a10a6a9e311fef8.1602139448.git.liu.denton@gmail.com","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-10-08T16:13:45Z","receivedAt":"2020-10-08T16:13:48Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 07, 2020 at 11:44:40PM -0700, Denton Liu wrote:\n\n> diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\n> index 57a77c03f9..d843df3afd 100755\n> --- a/contrib/git-resurrect.sh\n> +++ b/contrib/git-resurrect.sh\n> @@ -37,19 +37,18 @@ search_reflog_merges () {\n>  \t)\n>  }\n>  \n> -_x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n> -_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n> +oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g')\n\nThis looks correct, although...\n\n>  search_merges () {\n>  \tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n>  \t\t--pretty=tformat:\"%P %s\" |\n> -\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> +\tsed -ne \"/^$oid_pattern \\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>  }\n>  \n>  search_merge_targets () {\n>  \tgit rev-list --all --grep=\"Merge branch '[^']*' into $branch\\$\" \\\n>  \t\t--pretty=tformat:\"%H %s\" --all |\n> -\tsed -ne \"/^\\($_x40\\) Merge .*/ {s//\\1/p;$early_exit} \"\n> +\tsed -ne \"/^\\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit} \"\n>  }\n\nin both cases we are matching output we asked for, so we really matching\n[0-9a-f]\\+ would be correct and sufficient. That's a little simpler. I\ndon't feel too strongly either way, though.\n\n  Side note: It's a shame that there is no way to convince rev-list not\n  to print the \"commit ...\" header, which is really what we're avoiding\n  here. We probably should have suppressed it with user-formats when\n  they were introduced, but it's too late to make that change. I wonder\n  if it would be worth adding a command-line option, though. I've often\n  had to hack around this when parsing rev-list output (and sometimes\n  even resort to using git-log if it's a one-off).\n\n-Peff\n"},{"id":"407170","messageId":"xmqqa6wwy66x.fsf@gitster.c.googlers.com","threadId":"54369","inReplyTo":"5f5f1763043e80cbae6f9d4286aa5ba1960d32e0.1602139448.git.liu.denton@gmail.com","subject":"Re: [PATCH 1/2] contrib/git-resurrect.sh: indent with tabs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-08T17:32:22Z","receivedAt":"2020-10-08T17:32:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> In the git-resurrect script, there are a few lines that are mistakenly\n> indented with spaces. Replace these lines with tabs.\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  contrib/git-resurrect.sh | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\n> index 8c171dd959..57a77c03f9 100755\n> --- a/contrib/git-resurrect.sh\n> +++ b/contrib/git-resurrect.sh\n> @@ -27,7 +27,7 @@ n,dry-run            don't recreate the branch\"\n>  \n>  search_reflog () {\n>  \tsed -ne 's~^\\([^ ]*\\) .*\tcheckout: moving from '\"$1\"' .*~\\1~p' \\\n> -                < \"$GIT_DIR\"/logs/HEAD\n> +\t\t< \"$GIT_DIR\"/logs/HEAD\n>  }\n\nUnless this is done in preparation for a more meaningful change\n(like not reading from on-disk logs/HEAD and instead reading from\n\"git reflog\" output in order to help our future migration to the\nreftable backend), I do not think the reviewers' time is worth it\nfor cosmetic changes on this script.\n\n>  search_reflog_merges () {\n> @@ -41,9 +41,9 @@ _x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n>  _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n>  \n>  search_merges () {\n> -        git rev-list --all --grep=\"Merge branch '$1'\" \\\n> -                --pretty=tformat:\"%P %s\" |\n> -        sed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> +\tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n> +\t\t--pretty=tformat:\"%P %s\" |\n> +\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>  }\n>  \n>  search_merge_targets () {\n"},{"id":"407175","messageId":"xmqqwo00woz5.fsf@gitster.c.googlers.com","threadId":"54369","inReplyTo":"20201008161345.GD2823778@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-08T18:29:34Z","receivedAt":"2020-10-08T18:29:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Oct 07, 2020 at 11:44:40PM -0700, Denton Liu wrote:\n>\n>> diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\n>> index 57a77c03f9..d843df3afd 100755\n>> --- a/contrib/git-resurrect.sh\n>> +++ b/contrib/git-resurrect.sh\n>> @@ -37,19 +37,18 @@ search_reflog_merges () {\n>>  \t)\n>>  }\n>>  \n>> -_x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n>> -_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n>> +oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g')\n> ...\n> in both cases we are matching output we asked for, so we really matching\n> [0-9a-f]\\+ would be correct and sufficient. That's a little simpler. I\n> don't feel too strongly either way, though.\n\nYes.  I think use of _x40 is overrated.\n\n>   Side note: It's a shame that there is no way to convince rev-list not\n>   to print the \"commit ...\" header, which is really what we're avoiding\n>   here. We probably should have suppressed it with user-formats when\n>   they were introduced, but it's too late to make that change. I wonder\n>   if it would be worth adding a command-line option, though. I've often\n>   had to hack around this when parsing rev-list output (and sometimes\n>   even resort to using git-log if it's a one-off).\n\nOr make \"git log\" without frills as fast as rev-list, perhaps?\n\nWhat extra things do we do that makes \"log\" inherently slower than\n\"rev-list\"?\n\nI do not mind a new option (e.g. --no-header) to \"rev-list\", though.\n\nThanks.\n\n"},{"id":"407176","messageId":"xmqqsgaowo37.fsf@gitster.c.googlers.com","threadId":"54369","inReplyTo":"xmqqa6wwy66x.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 1/2] contrib/git-resurrect.sh: indent with tabs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-08T18:48:44Z","receivedAt":"2020-10-08T18:48:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Denton Liu <liu.denton@gmail.com> writes:\n>\n>> In the git-resurrect script, there are a few lines that are mistakenly\n>> indented with spaces. Replace these lines with tabs.\n>>\n>> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>> ---\n>>  contrib/git-resurrect.sh | 8 ++++----\n>>  1 file changed, 4 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\n>> index 8c171dd959..57a77c03f9 100755\n>> --- a/contrib/git-resurrect.sh\n>> +++ b/contrib/git-resurrect.sh\n>> @@ -27,7 +27,7 @@ n,dry-run            don't recreate the branch\"\n>>  \n>>  search_reflog () {\n>>  \tsed -ne 's~^\\([^ ]*\\) .*\tcheckout: moving from '\"$1\"' .*~\\1~p' \\\n>> -                < \"$GIT_DIR\"/logs/HEAD\n>> +\t\t< \"$GIT_DIR\"/logs/HEAD\n>>  }\n>\n> Unless this is done in preparation for a more meaningful change\n> (like not reading from on-disk logs/HEAD and instead reading from\n> \"git reflog\" output in order to help our future migration to the\n> reftable backend), I do not think the reviewers' time is worth it\n> for cosmetic changes on this script.\n>\n\nOK, so the \"meaningful\" part is to prepare for SHA-256 world.  That\nsort-of makes sense.\n\nBut don't we want to remove the SP after the redirection operator\non the same line, while we are looking at it?\n\n\n>>  search_reflog_merges () {\n>> @@ -41,9 +41,9 @@ _x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n>>  _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n>>  \n>>  search_merges () {\n>> -        git rev-list --all --grep=\"Merge branch '$1'\" \\\n>> -                --pretty=tformat:\"%P %s\" |\n>> -        sed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>> +\tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n>> +\t\t--pretty=tformat:\"%P %s\" |\n>> +\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>>  }\n>>  \n>>  search_merge_targets () {\n"},{"id":"407180","messageId":"20201008195309.GA2841047@coredump.intra.peff.net","threadId":"54369","inReplyTo":"xmqqwo00woz5.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-10-08T19:53:09Z","receivedAt":"2020-10-08T19:53:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 08, 2020 at 11:29:34AM -0700, Junio C Hamano wrote:\n\n> >   Side note: It's a shame that there is no way to convince rev-list not\n> >   to print the \"commit ...\" header, which is really what we're avoiding\n> >   here. We probably should have suppressed it with user-formats when\n> >   they were introduced, but it's too late to make that change. I wonder\n> >   if it would be worth adding a command-line option, though. I've often\n> >   had to hack around this when parsing rev-list output (and sometimes\n> >   even resort to using git-log if it's a one-off).\n> \n> Or make \"git log\" without frills as fast as rev-list, perhaps?\n> \n> What extra things do we do that makes \"log\" inherently slower than\n> \"rev-list\"?\n\nIt's not the speed of log that is a problem, but just that I usually try\nto use plumbing when scripting. So I often reach for rev-list first.\n\nI do think for just listing commit hashes that log is slower, though.\nOne reason is that when there's a commit-graph, it's not as good at\navoiding reading the commit objects. E.g.:\n\n  $ time git rev-list HEAD >/dev/null\n  real\t0m0.031s\n  user\t0m0.027s\n  sys\t0m0.004s\n\n  $ time git -c core.commitgraph=false rev-list HEAD >/dev/null\n  real\t0m0.362s\n  user\t0m0.345s\n  sys\t0m0.016s\n\n  $ time git log --format=%H HEAD >/dev/null\n  real\t0m0.371s\n  user\t0m0.355s\n  sys\t0m0.016s\n\nSo running \"git log\" takes about the same time as rev-list if we disable\nthe commit-graph. Which makes sense. The pretty-print code is aggressive\nabout loading the object contents, even if we end up not needing it\n(because really, everything _except_ userformat does need it, and even\nuserformat usually needs it).\n\nI think it would be nice to make the formatting code smarter about\nreporting exactly which parts it needs.\n\n> I do not mind a new option (e.g. --no-header) to \"rev-list\", though.\n\nI took a brief look at this earlier today and it was more awkward than I\nexpected. The \"commit <oid>\" header might also have other stuff attached\nto it (revision marks, parents, and who even knew we had a \"--timestamp\"\noption?). It's not clear where those things should go if we suppress the\nheader (for oneline, they just get stuck in front of the oneline; would\nthat be OK for userformats, too?).\n\n-Peff\n"},{"id":"407187","messageId":"20201008221101.GO1392312@camp.crustytoothpaste.net","threadId":"54369","inReplyTo":"20201008161345.GD2823778@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-10-08T22:11:01Z","receivedAt":"2020-10-08T22:11:59Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-10-08 at 16:13:45, Jeff King wrote:\n> On Wed, Oct 07, 2020 at 11:44:40PM -0700, Denton Liu wrote:\n> \n> > diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\n> > index 57a77c03f9..d843df3afd 100755\n> > --- a/contrib/git-resurrect.sh\n> > +++ b/contrib/git-resurrect.sh\n> > @@ -37,19 +37,18 @@ search_reflog_merges () {\n> >  \t)\n> >  }\n> >  \n> > -_x40=\"[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\"\n> > -_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n> > +oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g')\n> \n> This looks correct, although...\n\nWe could write this more simply as this:\n\n  oid_pattern=$(git hash-object /dev/null | sed -e 's/./[0-9a-f]/g')\n\nI'm almost certain that works just fine, even on Windows, and I think\nthe hashing code may be able to optimize better if we avoid --stdin\n(since it knows the size ahead of time).  The performance benefit, if\nany, won't be that significant, though, since we're only hashing 7\nbytes.\n\nThis is, of course, not worth a reroll in itself.\n\n> >  search_merges () {\n> >  \tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n> >  \t\t--pretty=tformat:\"%P %s\" |\n> > -\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> > +\tsed -ne \"/^$oid_pattern \\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> >  }\n> >  \n> >  search_merge_targets () {\n> >  \tgit rev-list --all --grep=\"Merge branch '[^']*' into $branch\\$\" \\\n> >  \t\t--pretty=tformat:\"%H %s\" --all |\n> > -\tsed -ne \"/^\\($_x40\\) Merge .*/ {s//\\1/p;$early_exit} \"\n> > +\tsed -ne \"/^\\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit} \"\n> >  }\n> \n> in both cases we are matching output we asked for, so we really matching\n> [0-9a-f]\\+ would be correct and sufficient. That's a little simpler. I\n> don't feel too strongly either way, though.\n\nThe problem here is that we'd need to write [0-9a-f][0-9a-f]* because\nthis is a BRE and a backslashed + here is a GNU extension.\n\nI'm fine with this patch (and patch 1) as it stands or with that change.\nI don't think this can be ambiguous, although if we think it can be\n(even with silly user behavior), then we should adopt this solution.\n\n>   Side note: It's a shame that there is no way to convince rev-list not\n>   to print the \"commit ...\" header, which is really what we're avoiding\n>   here. We probably should have suppressed it with user-formats when\n>   they were introduced, but it's too late to make that change. I wonder\n>   if it would be worth adding a command-line option, though. I've often\n>   had to hack around this when parsing rev-list output (and sometimes\n>   even resort to using git-log if it's a one-off).\n\nYeah, I use git log for scripting more often than I'd like because\nrev-list can't remove the header.  That would indeed be a welcome\nfeature.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"407201","messageId":"874kn3rfxy.fsf@igel.home","threadId":"54369","inReplyTo":"20201008221101.GO1392312@camp.crustytoothpaste.net","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2020-10-09T07:55:53Z","receivedAt":"2020-10-09T07:55:59Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Okt 08 2020, brian m. carlson wrote:\n\n> On 2020-10-08 at 16:13:45, Jeff King wrote:\n>> On Wed, Oct 07, 2020 at 11:44:40PM -0700, Denton Liu wrote:\n>> >  search_merges () {\n>> >  \tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n>> >  \t\t--pretty=tformat:\"%P %s\" |\n>> > -\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>> > +\tsed -ne \"/^$oid_pattern \\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit}\"\n>> >  }\n>> >  \n>> >  search_merge_targets () {\n>> >  \tgit rev-list --all --grep=\"Merge branch '[^']*' into $branch\\$\" \\\n>> >  \t\t--pretty=tformat:\"%H %s\" --all |\n>> > -\tsed -ne \"/^\\($_x40\\) Merge .*/ {s//\\1/p;$early_exit} \"\n>> > +\tsed -ne \"/^\\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit} \"\n>> >  }\n>> \n>> in both cases we are matching output we asked for, so we really matching\n>> [0-9a-f]\\+ would be correct and sufficient. That's a little simpler. I\n>> don't feel too strongly either way, though.\n>\n> The problem here is that we'd need to write [0-9a-f][0-9a-f]* because\n> this is a BRE and a backslashed + here is a GNU extension.\n\nI wonder why --pretty uses %s when it is filtered out again anyway?\n(There is also a duplicate --all.)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"407205","messageId":"20201009115335.GA2855114@coredump.intra.peff.net","threadId":"54369","inReplyTo":"874kn3rfxy.fsf@igel.home","subject":"Re: [PATCH 2/2] contrib/git-resurrect.sh: use hash-agnostic OID pattern","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-10-09T11:53:35Z","receivedAt":"2020-10-09T11:53:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 09, 2020 at 09:55:53AM +0200, Andreas Schwab wrote:\n\n> >> >  search_merges () {\n> >> >  \tgit rev-list --all --grep=\"Merge branch '$1'\" \\\n> >> >  \t\t--pretty=tformat:\"%P %s\" |\n> >> > -\tsed -ne \"/^$_x40 \\($_x40\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> >> > +\tsed -ne \"/^$oid_pattern \\($oid_pattern\\) Merge .*/ {s//\\1/p;$early_exit}\"\n> [...]\n> I wonder why --pretty uses %s when it is filtered out again anyway?\n> (There is also a duplicate --all.)\n\nIt does confirm that the commit in question is a (likely) merge commit,\nand not one that happens to have \"Merge branch 'foo'\" in the body, which\nthe earlier --grep would have hit. But it doesn't actually check for\n'foo' in the sed match, so it would be fooled by a commit message like:\n\n  Merge branch 'bar'\n\n    * bar:\n      Merge branch 'foo'\n\nIf we wanted to tighten that up, then sed should match the branch name.\nIf we're willing to accept the looseness, the whole thing could probably\nbe:\n\n  git rev-list --all --grep=\"Merge branch '$1'\" \\\n    --min-parents 2 --parents ${early_exit:-\"-1\"} |\n  awk '{print $3}'\n\nI'm happy either way, but I'm not sure anybody overly cares. Let's not\nderail Denton's actual fix to make the script work in a sha256 world.\n\n-Peff\n"}]}