Ensure that HEAD points to an active reference (so we can list the tree)
Describe the bug
The command git ls-tree HEAD should list the contents of a tree object. In other words, it should show the state of the tree at the ref and, by extension, the commit pointed to by HEAD.
The current value for HEAD is invalid and returns a fatal error when we try to use the command:
grader-service@grader-service-<somewhere>:~/git/jaas20/1/user/amccartn$ git ls-tree HEAD
fatal: Not a valid object name HEAD
grader-service@grader-service-<somewhere>:~/git/jaas20/1/user/fjaeger$ git ls-tree HEAD
fatal: Not a valid object name HEAD
To Reproduce
Steps to reproduce the behavior:
- log in to https://jaas20.jupyter.hpc.tuwien.ac.at as a registered user
- Submit a solution to the first assignment
- Attach a shell to the pod running grader-service
-
cd git/jaas20/1/user/<your-user> && git rev-parse HEAD
Expected behavior
grader-service@grader-service-<somewhere>:~/git/jaas20/1/user/amccartn$ git ls-tree HEAD
040000 tree 849f99b94187f3f4784e68b3176313a506c1bd25 .ipynb_checkpoints
100644 blob b9331bdd9368c6d889b75593ff4544db4f9052a4 adsolve.ipynb
100644 blob e059a52c231df1ef34e98b0f64512d4755e82123 data.csv
Aspects of a Solution
HEAD tries to reference the master branch
grader-service@grader-service-<somewhere>:~/git/jaas20/1/user/amccartn$ cat HEAD
ref: refs/heads/master
We can see by examining the refs, or git branches that master does not exist:
grader-service@grader-service-<somewhere>:~/git/jaas20/1/user/amccartn$ ls -l refs/heads/
total 1
-rw-r--r-- 1 grader-service grader-service 41 May 4 11:43 main
grader-service@grader-service-555c5c9b7d-f2qdj:~/git/jaas20/1/user/amccartn$ git branch
* main
We need to ensure that HEAD points to a valid commit, i.e. refs/heads/main
The subroutine that establishes the default global config for grader service should also run the command:
git config --global init.defaultbranch main
Actually this is the default behavior assuming that we have just initialized a new repository. However, as soon as we commit something, the HEAD should be updated to point at the most recent commit.
I would assume that hitting "submit" from the jupyter client causes the files I have worked on to be committed to the repository. Definitely the blob, tree and commit appear in the git directory after a "submit" takes place. Is there a reason that we are somehow avoiding the update to HEAD as we do this commit?