Staff Gitlet Guide (Instructional Servers)
Author: Boren Tsai

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

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:

  1. First you’ll need to retrieve the script in your proj2/testing/ folder. This will run the staff gitlet solution on your tests to verify their correctness. If the file is currently not in your proj2/testing/ folder, run git pull skeleton master to get it from the skeleton.
  2. To use this script on the instructional machines, push your most up-to-date tests and to Github. This is done via git add, git commit, and finally git push.
  3. Now ssh into your instructional account using the above directions.
  4. Now we will clone your repository via git clone*** with your own class id. You should now see a folder sp21-s*** when you type ls!
  5. Change directories into your proj2/testing/ folder, and you can use the following command to verify the correctness of your tests:
python3 [test to run]

For example, if you created a test called in the student_tests directory that you wanted to verify, you’d run:

python3 student_tests/

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!).