Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit aad08e6

Browse files
committed
plumbing: use LookPath instead of Stat to fix Windows executables
When git-core isn't in the user's PATH, we need to use `LookPath` to verify the existence of the executable, rather than `os.Stat`, so that on Windows it will search for files with executable suffixes.
1 parent 631a45f commit aad08e6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plumbing/transport/file/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func prefixExecPath(cmd string) (string, error) {
6666
cmd = filepath.Join(execPath, cmd)
6767

6868
// Make sure it actually exists.
69-
_, err = os.Stat(cmd)
69+
_, err = exec.LookPath(cmd)
7070
if err != nil {
7171
return "", err
7272
}

plumbing/transport/file/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (s *ClientSuite) TestCommand(c *C) {
3333

3434
// Make sure we get an error for one that doesn't exist.
3535
_, err = runner.Command("git-fake-command", ep, emptyAuth)
36-
c.Assert(os.IsNotExist(err), Equals, true)
36+
c.Assert(err, NotNil)
3737
}
3838

3939
const bareConfig = `[core]

0 commit comments

Comments
 (0)