mirror of https://git.jolheiser.com/ugit.git
parent
ad26f8c949
commit
79c3e14082
|
@ -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)
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue