Using the Staff Gitlet Implementation
To help you in Project 2: Gitlet, we’ve provided a way for you to run the staff’s implementation of the
project. This will allow you to test your understanding of the spec; specifically edge cases that you may be confused on (like checkout
and merge
commands). You’ll also be able to use this to validate test cases you create since you wouldn’t want to spend hours debugging a test just to find out your code was correct and your test was wrong the whole time :)
All of you will be able to access it via your cs61b instructional accounts. If you’re confused about what an instructional account is, don’t worry! Basically, they are computers that are locked in the dungeons of Soda that you have remote terminal access to! Magic! But I digress. Here’s a guide to help you get started.
Instructional Account: Signing Up and Signing In
- Visit this link to sign-up for an instructional account
- Log in using your Cal-Net information
- Under the column “Account Services”, click “get new account’ for cs61b
- Confirm on the subsequent page that loads
- Mark down your login and password information. We advise clicking “download named acct form” to save a .pdf hardcopy of your account information. Note that your login will be 3 letters, and your password will be some random string. We’ll show you later how to change your password to something more memorable.
- Using your account login, use
ssh cs61b-***@cory.eecs.berkeley.edu
orssh cs61b-***@ashby.cs.berkeley.edu
. Note that this***
is NOT your class id (the numbers), but rather the 3 letter ID you got in the previous step. - You should be prompted if you want to
continue connecting; type
yes
. Then enter your password. Note when typing your password it will not show up on your terminal for security reasons, but it’s still capturing your keystrokes, so keep typing and just hit enter when you’re done. - You should now be ssh’d into your instructional server. This means that this tab of your terminal is really issuing commands to the instructional server and displaying the results of those commands.
- After running the
ssh
command and logging into your instructional account, please run the commandregister
then complete the following prompts. - Optional: If you’d like to have a more memorable password, run
sshupdate
when inside your instructional server and follow the directions on how to change your password. It’ll first ask for your old password, so be ready to type in the mumbo jumbo default password again. If you ever forget your password or need to reset it, you can do so here
Staff Gitlet: Usage
All of your instructional accounts will have access to our staff solution. You can use this to see what the solution
does in particular edge cases as well as use it to validate your test cases. Remember, you can create files with
touch
, remove files with rm
, and edit files using nano
or vim
. You can
learn how to use nano here
and vim
here.
Run commands using staff-gitlet [...cmd...]
Here’s an example sequence of commands
staff-gitlet init
touch wug.txt
staff-gitlet add wug.txt
staff-gitlet commit "Add wug.txt"
NOTE: you will not see a .gitlet
folder; instead there will be a .gitlet.enc
file contains the encrypted version of .gitlet. This is so we do not leak how
staff organizes the .gitlet
directory.
Staff Gitlet: Testing Your Tests
We’ve provided a way to test the tests (.in
files) that you create! You will
need to clone your repository onto the instructional machines, so follow
these steps to do so:
- First you’ll need to retrieve the
staff-runner.py
script in yourproj2/testing/
folder. This will run the staff gitlet solution on your tests to verify their correctness. If thestaff-runner.py
file is currently not in yourproj2/testing/
folder, rungit pull skeleton master
to get it from the skeleton. - To use this script on the instructional machines, push your most up-to-date
tests and
staff-runner.py
to Github. This is done viagit add
,git commit
, and finallygit push
. - Now ssh into your instructional account using the above directions.
- Now we will clone your repository via
git clone https://github.com/Berkeley-CS61B-Student/sp21-s***
with your own class id. You should now see a foldersp21-s***
when you typels
! - Change directories into your
proj2/testing/
folder, and you can use the following command to verify the correctness of your tests:
python3 staff-runner.py [test to run]
For example, if you created a test called
student-test01-complicated-checkout.in
in the student_tests
directory that
you wanted to verify, you’d run:
python3 staff-runner.py student_tests/student-test01-complicated-checkout.in
Feel free to use flags like --keep
or --verbose
to look at the output of the
staff gitlet implementation in more depth, but the .gitlet.enc
folder will
still be encrypted. Remember to use the python3
command in the instructional
account, even if you use the py
or python
command on your own machine
(remember the instructional machine is an entirely different computer in the
Soda dungeons that you’re remotely issuing commands to).
If you add tests later you’ll need to pull them: this is done via git pull
on your instructional machine (make sure you’ve done git push
from your local
machine first!).