Skip to content

Commit 2aec73a

Browse files
committed
Fix git sync usage
1 parent 78954be commit 2aec73a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/hooks/useConfig.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,22 @@ function git(_prefix: Path, PATH?: string): Path | undefined {
124124
// only return /usr/bin if in the PATH so user can explicitly override this
125125
const rv = PATH?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined
126126

127-
/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
128-
//FIXME test! but this is hard to test without docker images or something!
129-
if (host().platform == 'darwin') {
130-
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
131-
if (new Path("/Applications/Xcode.app").isDirectory()) return rv
132-
return // don’t use `git`
133-
}
134-
135-
return rv?.join("bin/git")
127+
return (() => {
128+
/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
129+
//FIXME test! but this is hard to test without docker images or something!
130+
switch (host().platform) {
131+
case 'darwin':
132+
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
133+
if (new Path("/Applications/Xcode.app").isDirectory()) return rv
134+
return // probably won’t work without prompting the user to install the XcodeCLT
135+
case "linux":
136+
return rv
137+
case "windows":
138+
if (PATH) {
139+
//FIXME this is GitHub Actions specific
140+
return new Path('C:\Program Files\Git\cmd\git.exe')
141+
}
142+
}
143+
})()?.join("bin/git")
136144
}
137145
}

0 commit comments

Comments
 (0)