After cloning a repo with the separate git dir option the root folder acts strange in git version 2.31.0.
/local/repo> git clone <url> --separate-git-dir=.git main
After this command, the dir structure is:
/local/repo
/.git
/main
For some commands the /local/repo still seems associated with the worktree at /local/repo/main. For example:
switch
/local/repo> git switch banana
Switch to branch 'banana'
D a_file_in_the_repo.txt
It's possible to switch branch of the main working tree when standing at /local/repo, but when doing so ALL files in the repository are listed as deleted (D) (since they are not available with relative path from the current directory /local/repo I guess, but really /local/repo/main should have been used here I think?). Isn't this strange?
worktree list -v
/local/repo> git worktree list -v
/local/repo <hash0> [main]
Why is the worktree for main listed at /local/repo and not /local/repo/main?
branch -vv
/local/repo>git branch -vv
main <hash0> [origin/main] <commit message>
Why is the local dir for worktree not printed when standing at /local/repo? Expected output:
/local/repo>git branch -vv
main <hash0> (/local/repo/main) [origin/main] <commit message>