Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that HEAD points to an active reference (so we can list the tree) #80

Open
adammccartney opened this issue May 4, 2023 · 1 comment
Assignees

Comments

@adammccartney
Copy link
Member

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:

  1. log in to https://jaas20.jupyter.hpc.tuwien.ac.at as a registered user
  2. Submit a solution to the first assignment
  3. Attach a shell to the pod running grader-service
  4. 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
@adammccartney
Copy link
Member Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants