grumphp icon indicating copy to clipboard operation
grumphp copied to clipboard

Fix retrieving git worktree path

Open bart-jaskulski opened this issue 3 years ago • 2 comments

Q A
Branch master for features and deprecations
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Documented? no
Fixed tickets

@veewee Actually, I've made a bad assumption previously submitting PR (#1003) for git worktree path - git does store absolute path in .git file, but that's absolute path to the current worktree, while hooks are fired from common worktree root directory.

The hierarchy looks something like:

git-worktree
 > hooks
 > worktrees
   > worktree-1
      > commondir
   > worktree-2
      > commondir
worktree-1
  > .git
worktree-2
  > .git

With current patch, we are actually getting absolute path to worktree and reading the path from commondir file, which usually points up in hierarchy, to the root of git directory.

bart-jaskulski avatar May 19 '22 11:05 bart-jaskulski

Thanks for reporting @bart-jaskulski.

Configured myself some worktrees locally to see what is going on exactly. Looks like this implementation works. I did add some minor comments to make it less confusing for future reference.

veewee avatar May 27 '22 12:05 veewee

@bart-jaskulski Got any time to look at the comments I added above? Is there anything else I can do to get this merged?

veewee avatar Aug 26 '22 06:08 veewee