Please describe the problem.
The naming conventions for adjusted branches are poorly chosen (adjusted/master(unlocked) or adjusted/master(hidemissing)). The parentheses cause problems when checking out the branch without protecting the name by way of quotation marks. This problem is exacarbated at least on my Ubuntu Focal system by the fact that the provided bash-completion completes the branch name without those marks.
What version of git-annex are you using? On what operating system?
8.20200226-1 on Ubuntu Focal
What steps will reproduce the problem?
git annex adjust --hide-missing
git checkout master
#git checkout adjTABusted/master(hidemissing)
git checkout adjusted/master(hidemissing)
Result:
$ git checkout adjusted/master(hidemissing)
bash: syntax error near unexpected token `('
$ git checkout "adjusted/master(hidemissing)"
Switched to branch 'adjusted/master(hidemissing)'
The problem is easy to fix, I think, by choosing a different naming convention. I'm not sure how to deal with legacy-named branches going forward, though.
Thank you very much for making git-annex available, much appreciated.
One of the constraints on naming these is that the name needs to not be one that is likely to get in the way of something the user is doing with other branches, eg conflicting with another branch they have for something unrelated to git-annex.
Another constraint is that the name of the branch (either the whole thing or sometimes just the part after the slash) often appears in the user's prompt and so it would be good if it were reasonably short and also reasonably human readable and clear about what thing is checked out.
Those constraints are what led to this name choice. I am well aware there are reasons people won't typically use () in branch names, which along with the "adjusted/", helps make a naming conflict unlikely. And it avoids needing to also put "git-annex" in the branch name to avoid conflicts, so keeps it short, and the parens imply a relationship to master rather clearly.
I decided that needing to properly quote a shell parameter in the (somewhat uncommon) case of manually checking the branch out was a reasonable tradeoff.
It does seem like a bug in bash completion that it doesn't tab complete this correctly. I notice that tab completing a similar filename does escape the parens, so it may be that the bug can be fixed in the git completion file somehow.
Thank you for the your comment. It certainly explains your situation back when you coded this up. I'm not sure I'm convinced it is good justification to keep things the way they are going forward.
For #3, I usually rely on either mark-copy'ing the characters off the terminal with the mouse or via bash-completion. Both are broken.
Isn't it that people aren't using () for branch or filenames precisely because of the problems you will almost certainly run into? I'm certain there is a better way.
Personally, I see the act of hiding non-local files as a temporary measure. Maybe creating a branch for that isn't even the right thing. Maybe "git stash" or a tag is a better solution. Or maybe just remove broken links without committing the result at all.
To expand on that idea, https://unix.stackexchange.com/a/49470 discusses how to use find and I found "find . -maxdepth 1 -type l -exec test ! -e {} \; -delete" to work just fine. "git checkout ." then brought back those links for non-local files just fine. How about going without any branch at all? Obviously, in git-annex there are still some corner cases to consider. Like making sure not to continue on master while the links to non-local files are still removed. I haven't considered all potential pitfalls, but I feel this might be a better way to handle this need.