code: regress

ref: f362be8f65afb8dc5c18507d7f3750206ab4f0ec
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