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

Fix issue where "git subrepo commit" incorrectly gives error "There is no worktree available". #635

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reidgould
Copy link

Fix issue where git subrepo commit incorrectly gives error "There is no worktree available".

I encountered a merge conflict in a subrepo that has a name starting with a period character, .obsidian.

$> git subrepo pull .obsidian
The "git merge" command failed:

  Auto-merging plugins/obsidian-excalidraw-plugin/data.json
  CONFLICT (content): Merge conflict in plugins/obsidian-excalidraw-plugin/data.json
  Automatic merge failed; fix conflicts and then commit the result.

You will need to finish the pull by hand.
A new working tree has been created at .git/tmp/subrepo/%2eobsidian so that you can
resolve the conflicts shown in the output above.

This is the common conflict resolution workflow:

  1. cd .git/tmp/subrepo/%2eobsidian
  2. Resolve the conflicts (see "git status").
  3. "git add" the resolved files.
  4. git commit
  5. If there are more conflicts, restart at step 2.
  6. cd /mnt/c/Users/ReidG/data/repo/notes-vcm
  7. git subrepo commit .obsidian
See "git help merge" for details.

Alternatively, you can abort the pull and reset back to where you started:

  1. git subrepo clean .obsidian

See "git help subrepo" for more help.    

I follow all the recommended steps, resolving the conflicts and committing them.

But on the last step, the following error occurs.

$> git subrepo commit .obsidian 'subrepo/%2eobsidian'                     
git-subrepo: There is no worktree available, use the branch command first

I found that the git subrepo commit command uses the raw subdir variable to find the worktree, instead of the encoded gitref variable.

This PR changes commit to use the correct variable.

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

Successfully merging this pull request may close these issues.

1 participant