shithub: git9

Download patch

ref: 926e838a32a4c46d38a767e8970987e31c6b5864
parent: 764f431df487635942ac49888d71fc3a59e8104c
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Oct 18 16:18:00 EDT 2019

Make git/import strip empty lines from start of commit message.

--- a/git.h
+++ b/git.h
@@ -179,7 +179,7 @@
 	} while(0)
 
 #define QDIR(qid)	((int)(qid)->path & (0xff))
-#define QPATH(id, dt)	(((uvlong)(id) << 8) | ((dt) & 0x7f))
+#define _QPATH(id, dt)	(((uvlong)(id) << 8) | ((dt) & 0x7f))
 #define isblank(c) \
 	(((c) != '\n') && isspace(c))
 
--- a/import
+++ b/import
@@ -30,9 +30,6 @@
 		exit 'invalid branch '$branch
 	awk '
 	BEGIN{
-		state="begin"
-	}
-	state=="begin" && /^From[ \t]/ {
 		state="headers"
 	}
 	state=="headers" && /^From:/ {
@@ -52,12 +49,16 @@
 		msg=msg $0 "\n"
 	}
 	state=="headers" && /^$/ {
-		state="body"
+		state="prebody"
 	}
 	(state=="headers" || state=="body") && /^diff/ {
 		state="diff"
 		print > ENVIRON["diffpath"]
 	}
+	state=="prebody" && !/^(---[ 	]*)?$/{
+		print msg > "/env/msg"
+		state="body"
+	}
 	state=="body" {
 		print > "/env/msg"
 	}
@@ -78,9 +79,11 @@
 
 	# force re-reading env
 	rc -c '
-		echo $date
+		flag -e
+		echo applying $msg | sed 1q
 		date=`{seconds $date}
 		ape/patch -p1 < $diffpath
+		git/walk -fRMA
 		hash=`{git/save -n $name -e $email -m $msg -d $date $parents}
 		echo $hash > $refpath
 	'