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.
This commit is contained in:
parent
fe1b02113e
commit
d2942d4de3
1 changed files with 8 additions and 1 deletions
|
@ -45,12 +45,19 @@ fn apply @{
|
||||||
}
|
}
|
||||||
state=="headers" && /^$/ {
|
state=="headers" && /^$/ {
|
||||||
state="body"
|
state="body"
|
||||||
next
|
|
||||||
}
|
}
|
||||||
(state=="headers" || state=="body") && (/^diff / || /^---( |$)/){
|
(state=="headers" || state=="body") && (/^diff / || /^---( |$)/){
|
||||||
state="diff"
|
state="diff"
|
||||||
}
|
}
|
||||||
|
state=="body" && /^[ ]*$/ {
|
||||||
|
empty=1
|
||||||
|
next
|
||||||
|
}
|
||||||
state=="body" {
|
state=="body" {
|
||||||
|
if(empty)
|
||||||
|
printf "\n" > "/env/msg"
|
||||||
|
empty=0
|
||||||
|
sub(/[ ]+$/, "")
|
||||||
print > "/env/msg"
|
print > "/env/msg"
|
||||||
}
|
}
|
||||||
state=="diff" {
|
state=="diff" {
|
||||||
|
|
Loading…
Reference in a new issue