-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
If you're using Jujutsu, you cannot submit despite the HEAD being on the correct commit (ie. the tip of the master branch). Jujutsu leaves you in a detached HEAD state by default. You can switch the branch manually, and then submit works as expected.
A slight change to the branch detection command (adds no dependencies, and still only relies on git) will allow Jujutsu users to seamlessly use the codecrafters CLI.
I'm happy to make the change myself, but I wanted to make sure it would be accepted.
The issue stems from this code:
cli/internal/commands/submit.go
Lines 104 to 111 in b460df3
| func getCurrentBranch(repoDir string) (string, error) { | |
| outputBytes, err := exec.Command("git", "-C", repoDir, "rev-parse", "--abbrev-ref", "HEAD").CombinedOutput() | |
| if err != nil { | |
| return "", wrapError(err, outputBytes, "get current branch") | |
| } | |
| return strings.TrimSpace(string(outputBytes)), nil | |
| } |
This currently runs something like
git -C . rev-parse --abbrev-ref HEADand the following would make Jujutsu work as expected
git for-each-ref --format=%(refname:short) --points-at HEAD refs/headsReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels