Description
- I found no similar reported issue
- I am using 2.19.2.windows.1 and cygwin git version 2.17.0
- I am using Windows 10 home [Version 10.0.17134.407]
- I installed Git for Windows with the default options, except enabling symlinks
$ '/d/Program Files/Git/bin/git.exe' --version --build-options
git version 2.19.2.windows.1
cpu: x86_64
built from commit: 26dcaa1b6b5fd862db3ec40983e33ff3432f1166
sizeof-long: 4
sizeof-size_t: 8
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
Details
A worktree created by Cygwin's Git cannot be used by Git for Windows. This comes up because it's a reasonable workflow to use Git for Windows and Cygwin Git tools at the same time, for example to use the Windows GUI tools but Cygwin for everything else. This issue will also affect repositories on dual-boot systems if the user tries to use a worktree from both OSs.
Cygwin's Git cannot read a Windows-style path, and Git for Windows cannot read a POSIX path. Since the release notes say Git for Windows usually tries to recognize POSIX paths, the most obvious solution is for Git to also recognize POSIX paths in this case. Note: the path is written in
- What commands did you run to trigger this issue?
$ mkdir testcase
$ cd testcase/
$ /usr/bin/git init
Initialized empty Git repository in /f/Projects/testcase/.git/
Note: the steps and results are identical if I initialize in /cygdrive/f/Projects/testcase/. The folders are the same, and the POSIX version of the path points to the same directory as the Cygwin path.
$ /usr/bin/git commit -m "First commit" --allow-empty
[master (root-commit) d81570d] First commit
$ /usr/bin/git worktree add my-worktree
Preparing my-worktree (identifier my-worktree)
HEAD is now at d81570d First commit
$ cd my-worktree
$ '/d/Program Files/Git/bin/git.exe' status
- What did you expect to occur after running these commands?
On branch my-worktree
nothing to commit, working tree clean
- What actually happened instead?
fatal: not a git repository: /f/Projects/testcase/.git/worktrees/my-worktree
The file which lists the path is:
$ cat /f/Projects/testcase/my-worktree/.git
gitdir: /f/Projects/testcase/.git/worktrees/my-worktree