From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 5/5] patch-id: tighten code to detect the patch header
Date: Tue, 30 Jul 2024 07:12:10 +0200 [thread overview]
Message-ID: <Zqh2Kije5omYzDPY@tanuki> (raw)
In-Reply-To: <ZqhyI7Ta9g_4AwfI@tanuki>
[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]
On Tue, Jul 30, 2024 at 06:55:14AM +0200, Patrick Steinhardt wrote:
> On Mon, Jul 29, 2024 at 01:12:42PM -0700, Junio C Hamano wrote:
> > Patrick Steinhardt <ps@pks.im> writes:
> > > On Fri, Jun 21, 2024 at 04:18:26PM -0700, Junio C Hamano wrote:
> > "Skip non-diff garbage until we see a patch" is the mechanism used
> > to skip the log message, so it would be a reasonable thing to skip
> > such no-diff garbage between patches, no?
>
> Oh, yes, it is reasonable. I just didn't quite figure out the flow of
> the above loop when reading through the code. As you say, it is somewhat
> convoluted and not all that straight forward.
As far as I can see we didn't have a test for this yet, so I did have a
quick go at it to reassure myself that things work as expected before
and after your change. Feel free to pick it up if you feel like it, or
to just ignore it :)
Patrick
test_expect_success 'patch-id handles diffs with garbage in between' '
cat >diff-with-garbage <<-\EOF &&
$(git rev-parse HEAD)
diff --git a/bar b/bar
index bdaf90f..31051f6 100644
--- a/bar
+++ b/bar
@@ -2 +2,2 @@
b
+c
some
garbage
lines
$(git rev-parse HEAD)
diff --git a/car b/car
index 00750ed..2ae5e34 100644
--- a/car
+++ b/car
@@ -1 +1,2 @@
3
+d
EOF
cat >diff-without-garbage <<-\EOF &&
$(git rev-parse HEAD)
diff --git a/bar b/bar
index bdaf90f..31051f6 100644
--- a/bar
+++ b/bar
@@ -2 +2,2 @@
b
+c
$(git rev-parse HEAD)
diff --git a/car b/car
index 00750ed..2ae5e34 100644
--- a/car
+++ b/car
@@ -1 +1,2 @@
3
+d
EOF
for stable in true false
do
test_config patchid.stable $stable &&
git patch-id <diff-with-garbage >id-with-garbage &&
git patch-id <diff-without-garbage >id-without-garbage &&
test_line_count -eq 2 id-with-garbage &&
test_cmp id-with-garbage id-without-garbage ||
return 1
done
'
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-07-30 5:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 23:18 [PATCH 0/5] Tighten patch header parsing in patch-id Junio C Hamano
2024-06-21 23:18 ` [PATCH 1/5] t4204: patch-id supports various input format Junio C Hamano
2024-06-21 23:18 ` [PATCH 2/5] patch-id: call flush_current_id() only when needed Junio C Hamano
2024-06-21 23:18 ` [PATCH 3/5] patch-id: make get_one_patchid() more extensible Junio C Hamano
2024-07-29 12:02 ` Patrick Steinhardt
2024-07-29 20:03 ` Junio C Hamano
2024-06-21 23:18 ` [PATCH 4/5] patch-id: rewrite code that detects the beginning of a patch Junio C Hamano
2024-07-29 12:03 ` Patrick Steinhardt
2024-06-21 23:18 ` [PATCH 5/5] patch-id: tighten code to detect the patch header Junio C Hamano
2024-07-29 12:07 ` Patrick Steinhardt
2024-07-29 20:12 ` Junio C Hamano
2024-07-30 4:55 ` Patrick Steinhardt
2024-07-30 5:12 ` Patrick Steinhardt [this message]
2024-07-30 1:17 ` [PATCH v2 0/5] Tighten patch header parsing in patch-id Junio C Hamano
2024-07-30 1:17 ` [PATCH v2 1/5] t4204: patch-id supports various input format Junio C Hamano
2024-07-30 1:17 ` [PATCH v2 2/5] patch-id: call flush_current_id() only when needed Junio C Hamano
2024-07-30 1:17 ` [PATCH v2 3/5] patch-id: make get_one_patchid() more extensible Junio C Hamano
2024-07-30 1:17 ` [PATCH v2 4/5] patch-id: rewrite code that detects the beginning of a patch Junio C Hamano
2024-07-30 1:17 ` [PATCH v2 5/5] patch-id: tighten code to detect the patch header Junio C Hamano
2024-07-30 5:12 ` [PATCH v2 0/5] Tighten patch header parsing in patch-id Patrick Steinhardt
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=Zqh2Kije5omYzDPY@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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).