shithub: riscv

ref: faa625a1d5ab47ac0438b2cea5b2bde1ea747b8b
dir: /sys/src/cmd/git/test/basic.rc/

View raw version
#!/bin/rc

. util.rc

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

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

@{
	cd scratch
	$G/clone $wrkdir/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 $G/commit -m version2 file.txt
}
@{
	cd scratch/downstream
	q $G/pull
}
q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch

echo @@ version3 @@
@{
	cd scratch/upstream
	echo version3 > file2.txt
	$G/add file2.txt
	q $G/commit -m version3 file2.txt
}
@{
	cd scratch/downstream
	q $G/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
	$G/rm file2.txt
	rm file2.txt
	q $G/commit -m version4 file.txt file2.txt
}

@{
	cd scratch/downstream
	q $G/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