feat: pre-receive.d

Signed-off-by: jolheiser <git@jolheiser.com>
main
jolheiser 2024-07-29 14:08:31 -05:00
parent ad26f8c949
commit 79c3e14082
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -149,12 +149,19 @@ func requiredFS(repoDir string) error {
} }
fp = filepath.Join(fp, "pre-receive") fp = filepath.Join(fp, "pre-receive")
if err := os.MkdirAll(fp+".d", os.ModePerm); err != nil {
return err
}
fi, err := os.Create(fp) fi, err := os.Create(fp)
if err != nil { if err != nil {
return err return err
} }
fi.WriteString("#!/usr/bin/env bash\n") fi.WriteString("#!/usr/bin/env bash\n")
fi.WriteString(fmt.Sprintf("%s pre-receive-hook\n", bin)) fi.WriteString(fmt.Sprintf("%s pre-receive-hook\n", bin))
fi.WriteString(fmt.Sprintf(`for hook in %s.d/*; do
"${hook}"
done`, fp))
fi.Close() fi.Close()
return os.Chmod(fp, 0o755) return os.Chmod(fp, 0o755)

View File

@ -58,7 +58,6 @@ func gitService(ctx ReadWriteContexter, command, repoDir string, args ...string)
cmd.Env = append(os.Environ(), fmt.Sprintf("UGIT_REPODIR=%s", repoDir), "GIT_PROTOCOL=version=2") cmd.Env = append(os.Environ(), fmt.Sprintf("UGIT_REPODIR=%s", repoDir), "GIT_PROTOCOL=version=2")
cmd.Stdin = ctx cmd.Stdin = ctx
cmd.Stdout = ctx cmd.Stdout = ctx
fmt.Println(cmd.Env, cmd.String())
return cmd.Run() return cmd.Run()
} }