* [PATCH 2/3] solver: do not enforce order on extended headers
2020-01-04 3:34 5% [PATCH 0/3] more solver fixes Eric Wong
@ 2020-01-04 3:34 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-01-04 3:34 UTC (permalink / raw)
To: meta
This is needed to work with patches with many renames,
such as what makes "git/eebf7a8/s/?b=t%2Ftest-lib.sh"
---
lib/PublicInbox/SolverGit.pm | 23 ++++++++++++-----------
xt/solver.t | 2 +-
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index a78360fd..b12cd9d2 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -112,6 +112,8 @@ sub extract_diff ($$) {
}
state $LF = qr!\r?\n!;
+ state $ANY = qr![^\r\n]+!;
+ state $MODE = '100644|120000|100755';
state $FN = qr!(?:("?[^/\n]+/[^\r\n]+)|/dev/null)!;
$s =~ m!( # $1 start header lines we save for debugging:
@@ -124,17 +126,16 @@ sub extract_diff ($$) {
# try to get the pre-and-post filenames as $2 and $3
(?:^diff\x20--git\x20$FN\x20$FN$LF)
- # old mode $4
- (?:^old mode\x20(100644|120000|100755)$LF)?
-
- # ignore other info
- (?:^(?:copy|rename|deleted|dissimilarity|similarity).*$LF)?
-
- # new mode (possibly new file) ($5)
- (?:^new\x20(?:file\x20)?mode\x20(100644|120000|100755)$LF)?
-
- # ignore other info
- (?:^(?:copy|rename|deleted|dissimilarity|similarity).*$LF)?
+ (?:^(?: # pass all this to git-apply:
+ # old mode $4
+ (?:old\x20mode\x20($MODE))
+ |
+ # new mode (possibly new file) ($5)
+ (?:new\x20(?:file\x20)?mode\x20($MODE))
+ |
+ (?:(?:copy|rename|deleted|
+ dissimilarity|similarity)$ANY)
+ )$LF)*
)? # end of optional stuff, everything below is required
diff --git a/xt/solver.t b/xt/solver.t
index 238abecd..e9f24e7f 100644
--- a/xt/solver.t
+++ b/xt/solver.t
@@ -20,7 +20,7 @@ my $app = sub {
# TODO: convert these to self-contained test cases
my $todo = {
'git' => [
- # 'eebf7a8/s/?b=t%2Ftest-lib.sh', TODO
+ 'eebf7a8/s/?b=t%2Ftest-lib.sh',
'eb580ca513/s/?b=remote-odb.c',
'776fa90f7f/s/?b=contrib/git-jump/git-jump',
'5cd8845/s/?b=submodule.c',
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] more solver fixes
@ 2020-01-04 3:34 5% Eric Wong
2020-01-04 3:34 7% ` [PATCH 2/3] solver: do not enforce order on extended headers Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-01-04 3:34 UTC (permalink / raw)
To: meta
Eric Wong (3):
xt/solver.t: real-world regression tests
solver: do not enforce order on extended headers
solver: minor cleanups to diff extraction
MANIFEST | 1 +
lib/PublicInbox/SolverGit.pm | 41 +++++++++++++-------------
xt/solver.t | 57 ++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 21 deletions(-)
create mode 100644 xt/solver.t
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-01-04 3:34 5% [PATCH 0/3] more solver fixes Eric Wong
2020-01-04 3:34 7% ` [PATCH 2/3] solver: do not enforce order on extended headers Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.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).