git worktree bug: paths are being reset to the main repository directory
From: Daniel Egger <hidden>
Date: 2016-06-15 23:07:47
Hi guys,
doing a git reset --hard in one of the worktrees will reset the path in $GIT_DIR/worktrees/worktree_name/gitdir to .git, so after that point all thusly modified worktrees will look as if they live in current woorktree root.
State before:
# cd /Users/user/Desktop/Source/Product && git worktree list
/Users/user/Desktop/Source/Product 2991e32 [master]
/Users/user/Desktop/Source/Product-2.1 3fc1082 [releases/master-2.1]
/Users/user/Desktop/Source/Product-2.2 3ccc3fe [releases/master-2.2]
/Users/user/Desktop/Source/Product-2.3 4044881 [releases/master-2.3]
/Users/user/Desktop/Source/Product-2.3-S11 4a67d36 [customer/S11]
/Users/user/Desktop/Source/Product-2.2-S22 2d2503a [customer/S22]
# pushd /Users/user/Desktop/Source/Product-2.2; git reset --hard; popd
# git worktree list
/Users/user/Desktop/Source/Product 2991e32 [master]
/Users/user/Desktop/Source/Product-2.1 3fc1082 [releases/master-2.1]
/Users/user/Desktop/Source/Product 3ccc3fe [releases/master-2.2]
/Users/user/Desktop/Source/Product-2.3 4044881 [releases/master-2.3]
/Users/user/Desktop/Source/Product-2.3-S11 4a67d36 [customer/S11]
/Users/user/Desktop/Source/Product-2.3-S33 174575e [customer/S33]
/Users/user/Desktop/Source/Product-2.2-S22 2d2503a [customer/S22]
3ccc3fe is now (incorrectly) claimed to be represented in <pwd>.
Servus,
Daniel