* [PATCH] solver_git: workaround truncated `b' path in patch
@ 2024-06-11 18:54 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-06-11 18:54 UTC (permalink / raw)
To: meta
For messages like <780a3faf-9e44-64f4-a354-bdee39af3af5@redhat.com>
where the "diff --git" line is truncated, favor the filename from
the "+++ b/" line.
---
lib/PublicInbox/SolverGit.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index b5f6b96e..898ca72d 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -176,7 +176,7 @@ sub extract_diff ($$) {
(?:^---\x20$FN$LF)
# "+++ b/foo.c" sets post-filename ($11) in case
- # $3 is missing
+ # $3 is missing or truncated
(?:^\+{3}\x20$FN$LF)
# the meat of the diff, including "^\\No newline ..."
@@ -193,7 +193,8 @@ sub extract_diff ($$) {
mode_a => $5 // $8 // $4, # new (file) // unchanged // old
};
my $path_a = $2 // $10;
- my $path_b = $3 // $11;
+ my $path_b = defined $11 && defined $3 && length $11 > length $3 ?
+ $11 // $3 : $3 // $11;
my $patch = $9;
# don't care for leading 'a/' and 'b/'
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-11 18:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 18:54 [PATCH] solver_git: workaround truncated `b' path in patch Eric Wong
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).