bugs/git worktree remove failsgit-annexhttp://git-annex.branchable.com/bugs/git_worktree_remove_fails/git-annexikiwiki2019-03-18T19:54:04Zcomment 1http://git-annex.branchable.com/bugs/git_worktree_remove_fails/comment_1_e980c49fb53a785337e206feae34d032/joey2019-03-18T17:58:40Z2019-03-18T17:35:20Z
<p>This seems like something the git developers might consider a bug in git
worktree, since generally git doesn't care if .git is a symlink or a
pointer file.</p>
<p>Although perhaps the reason it checks is to avoid deleting something it
didn't set up.</p>
<p>I don't see any way to improve this in git-annex though, if .git is not a
symlink then every git-annex symlink in the repository will need to change
to point to the real path to .git/annex/objects, which is not practical.</p>
comment 2http://git-annex.branchable.com/bugs/git_worktree_remove_fails/comment_2_2c6ce2244c885bb21ca82a841987dd47/Ilya_Shlyakhter2019-03-18T19:54:04Z2019-03-18T19:54:04Z
<p>Maybe git considers .git an internal detail, so they might not guarantee things working correctly if it's changed to a symlink?
A clean way to handle this would be to add a 'git annex worktree' command, which normally just passes the rest of the command line to 'git worktree', but handles any git-annex-specific details as needed: e.g. 'git annex worktree add' calls 'git worktree add' then replaces the .git pointer file with symlink; 'git annex worktree remove' puts the .git pointer back then calls 'git worktree remove', etc.</p>