Skip to content

Instantly share code, notes, and snippets.

@loriopatrick
Created April 15, 2015 05:49
Show Gist options
  • Save loriopatrick/c59955fb6490f6429962 to your computer and use it in GitHub Desktop.
Save loriopatrick/c59955fb6490f6429962 to your computer and use it in GitHub Desktop.
Test gitlet with bash
# execute commands
gitlet init
echo 'a init' > a_other_change.txt
echo 'b init' > b_master_change.txt
echo 'c init' > c_other_remove.txt
echo 'd init' > d_master_remove.txt
echo 'e init' > e_both_remove.txt
echo 'f init' > f_both_change.txt
gitlet add a_other_change.txt
gitlet add b_master_change.txt
gitlet add c_other_remove.txt
gitlet add d_master_remove.txt
gitlet add e_both_remove.txt
gitlet add f_both_change.txt
echo 'Added files'
gitlet commit 'First'
gitlet branch other
echo 'Created branch: other'
echo 'b changed' > b_master_change.txt
echo 'f changed' > f_both_change.txt
gitlet add b_master_change.txt
gitlet add f_both_change.txt
gitlet rm d_master_remove.txt
gitlet rm e_both_remove.txt;
gitlet commit 'Updated master'
gitlet checkout other
echo 'Updated master and checked out to other'
echo 'a changed' > a_other_change.txt
echo 'f changed' > f_both_change.txt
gitlet add a_other_change.txt
gitlet add f_both_change.txt
gitlet rm c_other_remove.txt
gitlet rm e_both_remove.txt
gitlet commit 'Updated other'
gitlet checkout master
gitlet merge other
alias gitlet="echo yes | java ${VERSION}"
export RESTORE=$PWD
rm -rf $TEST_DIR && mkdir $TEST_DIR && cd $TEST_DIR;
source $RESTORE/$TEST
cat * > res.txt
cd $RESTORE
export CLASSPATH=/home/plorio/School/cs61b/build/:/home/plorio/School/cs61b/lib/*
export TEST="commands.sh"
export TEST_DIR="myGit"
export VERSION="Gitlet"
source container.sh
export TEST_DIR="staffGit"
export VERSION="StaffGitlet"
source container.sh
echo 'difference?'
diff myGit/res.txt staffGit/res.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment