ref: 798375ad4531e944f18c4b4cc4c45f00b678ec9f
parent: 99d69b52b3fa59b3c4414f1d3a711b3ba18ef52e
author: Michael Forney <mforney@mforney.org>
date: Tue Apr 26 15:06:53 EDT 2022
git/import: squash leading/trailing/consecutive blanks and strip trailing space This fixes importing patches with multiline commit messages generated by git-format-patch. It also matches commit message sanitation done by git-am.
--- a/sys/src/cmd/git/import
+++ b/sys/src/cmd/git/import
@@ -45,12 +45,19 @@
}
state=="headers" && /^$/ {
state="body"
- next
}
(state=="headers" || state=="body") && (/^diff / || /^---( |$)/){
state="diff"
}
+ state=="body" && /^[ ]*$/ {
+ empty=1
+ next
+ }
state=="body" {
+ if(empty)
+ printf "\n" > "/env/msg"
+ empty=0
+ sub(/[ ]+$/, "")
print > "/env/msg"
}
state=="diff" {