Skip to content

Commit

Permalink
Fix git sync usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Feb 16, 2024
1 parent 78954be commit 2aec73a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/hooks/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,22 @@ function git(_prefix: Path, PATH?: string): Path | undefined {
// only return /usr/bin if in the PATH so user can explicitly override this
const rv = PATH?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined

/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
//FIXME test! but this is hard to test without docker images or something!
if (host().platform == 'darwin') {
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
if (new Path("/Applications/Xcode.app").isDirectory()) return rv
return // don’t use `git`
}

return rv?.join("bin/git")
return (() => {
/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
//FIXME test! but this is hard to test without docker images or something!
switch (host().platform) {
case 'darwin':
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
if (new Path("/Applications/Xcode.app").isDirectory()) return rv
return // probably won’t work without prompting the user to install the XcodeCLT
case "linux":
return rv
case "windows":
if (PATH) {
//FIXME this is GitHub Actions specific
return new Path('C:\Program Files\Git\cmd\git.exe')
}
}
})()?.join("bin/git")
}
}

0 comments on commit 2aec73a

Please sign in to comment.