ref: 371a06bcf74b94cc885ecf8b7b3aad84aa246b5f
dir: /sys/src/cmd/git/test/basic.rc/
#!/bin/rc
. util.rc
wrkdir=`{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
git/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 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