Skip to content

Commit 61145ea

Browse files
committed
More robust post-commit hook #59
1 parent de7719a commit 61145ea

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

project/project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var (
3434
"post-commit": {
3535
Exe: "gtm",
3636
Command: "gtm commit --yes",
37-
RE: regexp.MustCompile(`(?s)[/,\\,:,a-z,A-Z,0-9,$,-,_,=,(,),",., ]*gtm(.exe"|)\s+commit\s+--yes\.*`)},
37+
RE: regexp.MustCompile(`(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*gtm(.exe"|)\s+commit\s+--yes\.*`)},
3838
}
3939
// GitConfig is map of git configuration settings
4040
GitConfig = map[string]string{

scm/git.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,9 @@ func (g GitHook) getCommandPath() string {
581581
}
582582
if runtime.GOOS == "windows" {
583583
// put "" around file path
584-
return strings.Replace(g.Command, g.Exe, fmt.Sprintf("\"%s\"", p), 1)
584+
return strings.Replace(g.Command, g.Exe, fmt.Sprintf("%s || \"%s\"", g.Command, p), 1)
585585
}
586-
return strings.Replace(g.Command, g.Exe, p, 1)
586+
return strings.Replace(g.Command, g.Exe, fmt.Sprintf("%s || %s", g.Command, p), 1)
587587
}
588588

589589
func (g GitHook) getExeForOS() string {

0 commit comments

Comments
 (0)