shithub: regress

ref: ac7c8364ea8f5992e6e56d6f0073869bcf64bb0d
dir: /cmd/git/basic.rc/

View raw version
#!/bin/rc

. ../util.rc

pwd=`{pwd}
rm -fr scratch
mkdir -p scratch/upstream

echo @@ version1 @@
@{
	cd scratch/upstream
	q git/init
	echo version1 > file.txt
	q git/add file.txt
	q git/commit -m version1 file.txt
}

@{
	cd scratch
	q git/clone $pwd/scratch/upstream downstream
}

diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch

echo @@ version2 @@
@{
	cd scratch/upstream
	echo version2 > file.txt
	q git/commit -m version2 file.txt
}
@{
	cd scratch/downstream
	q git/pull
}
q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch

echo @@ version3 @@
@{
	cd scratch/upstream
	echo version3 > file2.txt
	git/add file2.txt
	q git/commit -m version3 file2.txt
}
@{
	cd scratch/downstream
	q git/pull
}
q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
q diff -c scratch/upstream/file2.txt scratch/downstream/file2.txt || die mismatch

echo @@ version4 @@
@{
	cd scratch/upstream
	echo version4 > file.txt
	git/rm file2.txt
	rm file2.txt
	q git/commit -m version4 file.txt file2.txt
}

@{
	cd scratch/downstream
	q git/pull
}
q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
! test -e scratch/upstream/file2.txt || die mismatch
! test -e scratch/downstream/file2.txt || die mismatch