Skip to content

[rush] Git hooks feature causes Rush commands to fail in worktrees #990

Description

If the current directory is a Git worktree (rather than a full copy of a repo), the new Git hooks feature causes rush commands to fail:

Rush Multi-Project Build Tool 5.5.3 - https://rushjs.io

Starting "rush install"

Ignoring Git validation because this is not a Git working folder.

Found files in the "common/git-hooks" folder.

ERROR: EEXIST: file already exists, mkdir 'D:\git\fabric-react2\.git'

This is because instead of having a .git directory, a worktree has a .git file containing the path to the real Git metadata directory. For example:

gitdir: D:/git/fabric-react/.git/worktrees/fabric-react2

I just made a change to git-repo-info to make it return the directories containing Git metadata for the worktree and for the repo all-up. Once that's published, Rush can be updated to put hooks in the correct directory for the current worktree.

(If anyone is curious, this blog post has a good explanation of the appeal of worktrees.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue is asking for a new feature or design change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions