shithub: git9

Download patch

ref: 79db1946bb5be5948746ac90802b789d67ddfc4e
parent: 8bbf796fb72edb83f540663ecfe83eb4cfab599f
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Oct 17 18:16:26 EDT 2019

Fix git/import.

--- a/import
+++ b/import
@@ -19,7 +19,7 @@
 	email=''
 	name=''
 	msg=''
-	parents='-p'^`{cat /mnt/git/HEAD/parent}
+	parents='-p'^`{git/query HEAD}
 	diffpath=/tmp/gitimport.$pid.diff
 	branch=`{awk '$1=="branch"{print $2}' < /mnt/git/ctl}
 	if(test -e /mnt/git/branch/$branch/tree)
@@ -28,7 +28,6 @@
 		refpath=.git/HEAD
 	if not
 		exit 'invalid branch '$branch
-
 	awk '
 	BEGIN{
 		state="begin"
@@ -77,10 +76,14 @@
 	}
 	'
 
-	date=`{seconds $date}
-	ape/patch -p1 < $diffpath
-	hash=`{git/save -n $name -e $email -m $msg -d $date $parents}
-	echo $hash > $refpath
+	# force re-reading env
+	rc -c '
+		echo $date
+		date=`{seconds $date}
+		ape/patch -p1 < $diffpath
+		hash=`{git/save -n $name -e $email -m $msg -d $date $parents}
+		echo $hash > $refpath
+	'
 }
 
 fn import{
@@ -92,8 +95,8 @@
 	}
 }
 
-if(~ $#* 0){
-	import
-if not
-	for(f in $*)
-		import < $f
+patches=(/fd/0)
+if(! ~ $#* 0)
+	patches=$*
+for(f in $patches)
+	import < $f