mirror of https://github.com/perkeep/perkeep.git
devcam test: run devcam hook pre-commit
Instead of the old ./misc/pre-commit.githook Also fix devcam hook pre-commit so we don't show the override message in that case. Change-Id: I390016765056b9c4d3331d12bef8f2581e5621df
This commit is contained in:
parent
def28fc337
commit
974ed85e2e
|
@ -112,7 +112,9 @@ func (c *hookCmd) RunCommand(args []string) error {
|
||||||
switch args[0] {
|
switch args[0] {
|
||||||
case "pre-commit":
|
case "pre-commit":
|
||||||
if err := c.hookPreCommit(args[1:]); err != nil {
|
if err := c.hookPreCommit(args[1:]); err != nil {
|
||||||
printf("You can override these checks with 'git commit --no-verify'\n")
|
if !(len(args) > 1 && args[1] == "test") {
|
||||||
|
printf("You can override these checks with 'git commit --no-verify'\n")
|
||||||
|
}
|
||||||
cmdmain.ExitWithFailure = true
|
cmdmain.ExitWithFailure = true
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func init() {
|
||||||
cmdmain.RegisterCommand("test", func(flags *flag.FlagSet) cmdmain.CommandRunner {
|
cmdmain.RegisterCommand("test", func(flags *flag.FlagSet) cmdmain.CommandRunner {
|
||||||
cmd := new(testCmd)
|
cmd := new(testCmd)
|
||||||
flags.BoolVar(&cmd.short, "short", false, "Use '-short' with go test.")
|
flags.BoolVar(&cmd.short, "short", false, "Use '-short' with go test.")
|
||||||
flags.BoolVar(&cmd.precommit, "precommit", true, "Run misc/pre-commit.githook as part of tests.")
|
flags.BoolVar(&cmd.precommit, "precommit", true, "Run the pre-commit githook as part of tests.")
|
||||||
flags.BoolVar(&cmd.verbose, "v", false, "Use '-v' (for verbose) with go test.")
|
flags.BoolVar(&cmd.verbose, "v", false, "Use '-v' (for verbose) with go test.")
|
||||||
flags.StringVar(&cmd.run, "run", "", "Use '-run' with go test.")
|
flags.StringVar(&cmd.run, "run", "", "Use '-run' with go test.")
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -158,7 +158,7 @@ func (c *testCmd) runTests(args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testCmd) runPrecommitHook() error {
|
func (c *testCmd) runPrecommitHook() error {
|
||||||
out, err := exec.Command(filepath.FromSlash("./misc/pre-commit.githook"), "test").CombinedOutput()
|
out, err := exec.Command(filepath.FromSlash("./bin/devcam"), "hook", "pre-commit", "test").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(string(out))
|
fmt.Println(string(out))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue