ref: da809634e9cb0668ff9d0a37b297a4720ab79086
parent: 1cd827f327dba16b704e65c1f83d15b962f042d3
author: Ori Bernstein <[email protected]>
date: Tue Oct 22 02:32:15 EDT 2019
Improve the git/import script: don't grab some spare junk.
--- a/import
+++ b/import
@@ -49,16 +49,12 @@
msg=msg $0 "\n"
}
state=="headers" && /^$/ {
- state="prebody"
+ state="body"
}
- (state=="headers" || state=="body") && /^diff/ {
+ (state=="headers" || state=="body") && (/^diff/ || /^---[ ]*$/){
state="diff"
print > ENVIRON["diffpath"]
}
- state=="prebody" && !/^(---[ ]*)?$/{
- print msg > "/env/msg"
- state="body"
- }
state=="body" {
print > "/env/msg"
}
@@ -68,8 +64,10 @@
END{
if(state != "diff")
exit("malformed patch: " state);
- if(name == "" || email == "" || msg == "" || date=="")
- print "missing headers"
+ if(name == "" || email == "" || msg == "" || date == ""){
+ print "missing headers" > "/fd/2";
+ exit("missingheader");
+ }
printf "%s", name > "/env/name"
printf "%s", email > "/env/email"
printf "%s", msg > "/env/msg"
@@ -76,6 +74,11 @@
printf "%s", date > "/env/date"
}
'
+ st=$status
+ if(! ~ $st ''){
+ echo could not import: $st >[1=2]
+ exit badpatch
+ }
# force re-reading env
rc -c '