1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-22 04:08:49 +02:00

docs: clarify hooks

closes #741
This commit is contained in:
Carlos Alexandro Becker 2018-08-15 00:18:59 -03:00
parent f4d0a61fdc
commit 815ffc2a83
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
4 changed files with 13 additions and 4 deletions

View File

@ -71,7 +71,7 @@ favicon:
.PHONY: favicon
serve:
@hugo server --enableGitInfo --watch --source www
@hugo server --enableGitInfo --watch --source www --disableFastRender
.PHONY: serve
# Show to-do items per file.

View File

@ -10,9 +10,9 @@ import (
)
// IsRepo returns true if current folder is a git repository
func IsRepo() bool {
func IsRepo() (bool, error) {
out, err := Run("rev-parse", "--is-inside-work-tree")
return err == nil && strings.TrimSpace(out) == "true"
return err == nil && strings.TrimSpace(out) == "true", err
}
// Run runs a git command and returns its output or errors

View File

@ -11,7 +11,11 @@ import (
// remoteRepo gets the repo name from the Git config.
func remoteRepo() (result config.Repo, err error) {
if !git.IsRepo() {
isRepo, err := git.IsRepo()
if err != nil {
return result, err
}
if !isRepo {
return result, errors.New("current folder is not a git repository")
}
out, err := git.Run("config", "--get", "remote.origin.url")

View File

@ -20,3 +20,8 @@ before:
```
If any of the hooks fails the build process is aborted.
It is important to note that you can't have "complex" commands, like
`bash -c "echo foo bar"` or `foo | bar` or anything like that. If you need
to do things that are more complex than just calling a command with some
attributes, wrap it in a shell script or into your `Makefile`.