Skip to content

Commit a524e51

Browse files
committed
Replace backslashes in file path names.
Fixes issues not deploying files under the right paths using Windows. Signed-off-by: David Calavera <[email protected]>
1 parent 83e8a53 commit a524e51

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

go/porcelain/deploy.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,11 @@ func walk(dir string, observer DeployObserver) (*deployFiles, error) {
460460
}
461461

462462
if !info.IsDir() && info.Mode().IsRegular() {
463-
rel, err := filepath.Rel(dir, path)
463+
osRel, err := filepath.Rel(dir, path)
464464
if err != nil {
465465
return err
466466
}
467+
rel := forceSlashSeparators(osRel)
467468

468469
if ignoreFile(rel) {
469470
return nil

go/porcelain/deploy_unix.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// +build !windows
2+
package porcelain
3+
4+
func forceSlashSeparators(name string) string {
5+
return name
6+
}

go/porcelain/deploy_windows.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package porcelain
2+
3+
import (
4+
"os"
5+
"strings"
6+
)
7+
8+
func forceSlashSeparators(name string) string {
9+
return strings.Replace(name, os.PathSeparator, "/", -1)
10+
}

0 commit comments

Comments
 (0)