shithub: regress

Download patch

ref: 071991480396986f294993a26bc866d69521b54d
parent: 9a91d5b20e00cf2a74ef82aa0d6f1f4d847dc04f
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jul 18 12:20:32 EDT 2021

add basic git tests

diff: cannot open b/cmd/git//null: file does not exist: 'b/cmd/git//null'
--- /dev/null
+++ b/cmd/git/git.rc
@@ -1,0 +1,57 @@
+#!/bin/rc
+
+pwd=`{pwd}
+rm -fr repo
+mkdir -p repo/upstream
+
+echo @@ version1 @@
+@{cd repo/upstream
+git/init
+echo version1 > file.txt
+git/add file.txt
+git/commit -m version1 file.txt
+}
+
+@{cd repo
+git/clone $pwd/repo/upstream downstream
+}
+
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+
+echo @@ version2 @@
+@{cd repo/upstream
+echo version2 > file.txt
+git/commit -m version2 file.txt
+}
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+
+echo @@ version3 @@
+@{cd repo/upstream
+echo version3 > file2.txt
+git/add file2.txt
+git/commit -m version3 file2.txt
+}
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+diff -c repo/upstream/file2.txt repo/downstream/file2.txt
+
+echo @@ version4 @@
+@{cd repo/upstream
+echo version4 > file.txt
+git/rm file2.txt
+rm file2.txt
+git/commit -m version4 file.txt file2.txt
+}
+
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+! test -e repo/upstream/file2.txt
+! test -e repo/downstream/file2.txt
+
--- /dev/null
+++ b/cmd/git/mkfile
@@ -1,0 +1,5 @@
+</$objtype/mkfile
+
+TEST=git
+
+<../../regress
--- /dev/null
+++ b/cmd/git/test.rc
@@ -1,0 +1,56 @@
+#!/bin/rc -e
+
+pwd=`{pwd}
+rm -fr repo
+mkdir -p repo/upstream
+
+echo version1
+
+@{cd repo/upstream
+git/init
+echo version1 > file.txt
+git/add file.txt
+git/commit -m version1 file.txt
+}
+
+@{cd repo
+git/clone $pwd/repo/upstream downstream
+}
+
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+
+echo version2
+@{cd repo/upstream
+echo version2 > file.txt
+git/commit -m version2 file.txt
+}
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+
+echo version3
+@{cd repo/upstream
+echo version3 > file2.txt
+git/add file2.txt
+git/commit -m version3 file2.txt
+}
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+diff -c repo/upstream/file2.txt repo/downstream/file2.txt
+
+echo version4
+@{cd repo/upstream
+echo version4 > file.txt
+git/rm file2.txt
+git/commit -m version4 file.txt file2.txt
+}
+
+@{cd repo/downstream
+git/pull
+}
+diff -c repo/upstream/file.txt repo/downstream/file.txt
+diff -c repo/upstream/file2.txt repo/downstream/file2.txt
+
--- a/cmd/mkfile
+++ b/cmd/mkfile
@@ -3,6 +3,7 @@
 TEST=\
 	cpp\
 	date\
+	git\
 	test\
 
 <../regress