shithub: regress

Download patch

ref: 4d955c05e146a5d9f42b90775fa49e376e218474
parent: 6dcdf888b80f11a4ccf8109326f8b2a36fb173b2
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Aug 12 11:14:45 EDT 2021

cmd/git: add tests for export/import

--- /dev/null
+++ b/cmd/git/export.rc
@@ -1,0 +1,43 @@
+#!/bin/rc
+
+#!/bin/rc
+
+. ../util.rc
+. ../util.rc
+
+rm -fr scratch
+mkdir -p scratch
+cd scratch
+
+# setup test repo
+@{
+	rfork ne
+	q git/init a
+
+	cd a
+	echo hello > a
+	echo goodbye > b
+	q git/add a b
+	q git/commit -m v1 .
+	cd ..
+	pwd
+	q git/clone `{pwd}^/a b
+}
+
+echo @@ export and apply @@
+@{
+	rfork ne
+	@{
+		cd b
+		echo hihi > b
+		q git/commit -m export1 b
+		git/export > ../export1.patch
+	}
+
+	@{
+		cd a
+		q git/import ../export1.patch
+	}
+}
+
+~ `{cd a && git/query HEAD} `{cd b && git/query HEAD} || die 'mismatched export'
--- a/cmd/git/mkfile
+++ b/cmd/git/mkfile
@@ -2,6 +2,7 @@
 
 TEST=\
 	basic\
+	export\
 	merge
 
 <../../regress