Skip to content

scalar clone fails when scalar and microsoft-git are installed via Homebrew #401

@andlee-msft

Description

@andlee-msft

On a brand-new macOS 10.15.5 installation, I installed Homebrew, and then I ran:

brew install watchman
brew tap microsoft/git
brew cask install scalar-azrepos

Then, when I try to actually clone, I got this (blacking out the exact repo):

andlee@Andrews-MacBook-Pro en2 % scalar clone https://dev.azure.com/####/####/_git/#### .
Authenticating...Succeeded
Querying remote for config...Succeeded
Using cache server: Global (https://wbp-adoprx.microsoft.engineering/ba47400f-eebe-4850-a8bf-ef694ef81414)

WARNING: Unable to validate your Scalar version
Server not configured to provide supported Scalar versions

Querying remote for repo info...Succeeded
Cloning...Failed

Cannot clone @ /Volumes/o3/en2
Error: Failed to set initial config: Failed to configure Watchman integration: Could not find a part of the path '/usr/local/git/share/git-core/templates/hooks/fsmonitor-watchman.sample'.
andlee@Andrews-MacBook-Pro en2 % 

I think it has to do with a mismatch between where Scalar assumes the Git installation lives, and how microsoft-git is installed via Homebrew.

When I had microsoft-git installed via Homebrew, which git yielded /usr/local/bin/git, which was symlinked to ../Cellar/microsoft-git/2.27.0.vfs.1.0/bin/git. And the hook templates were located at /usr/local/Cellar/microsoft-git/2.27.0.vfs.1.0/share/git-core/templates/hooks.

When I had Git installed using the installer from this release (git-2.27.0.vfs.1.0-intel-universal-snow-leopard.pkg
), which git also yielded /usr/local/bin/git, but here, it was symlinked to ../git/bin/git. And the hook templates were located at /usr/local/git/share/git-core/templates/hooks.

Looking at the error I got from trying to clone, it looks like it's trying to look for the default hooks samples provided with the Git installation. Specifically, it seemed to be trying to find them at the path specified by this line:

return Path.Combine("/usr", "local", "git", ScalarConstants.InstalledGit.HookTemplateDir);

So in a way, it seems hard-coded with the second location. Maybe to make it more robust, it should follow the git symlinks to their target, and then find the templates from there?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions