-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tronje Krop <[email protected]>
- Loading branch information
Showing
9 changed files
with
40 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ export GO ?= go | |
export GOPATH ?= $(shell $(GO) env GOPATH) | ||
export GOBIN ?= $(GOPATH)/bin | ||
# Setup go-make to utilize desired build and config scripts. | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].48 | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].49 | ||
# Request targets from go-make targets target. | ||
TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ | ||
$(GO) install $(GOMAKE_DEP) >/dev/stderr && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.48 | ||
0.0.49 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ export GO ?= go | |
export GOPATH ?= $(shell $(GO) env GOPATH) | ||
export GOBIN ?= $(GOPATH)/bin | ||
# Setup go-make to utilize desired build and config scripts. | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].48 | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].49 | ||
# Request targets from go-make targets target. | ||
TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ | ||
$(GO) install $(GOMAKE_DEP) >/dev/stderr && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ go-pkg = $(shell awk -v mode="$(2)" -v filter="$(3)" \ | |
}' <<<"$(1)") | ||
|
||
# Setup go-make to use desired build and config scripts. | ||
GOMAKE_DEP := github.com/tkrop/[email protected].48 | ||
GOMAKE_DEP := github.com/tkrop/[email protected].49 | ||
GOMAKE_MAKEFILE := $(realpath $(firstword $(MAKEFILE_LIST))) | ||
GOMAKE_CONFIG := $(patsubst %/,%,$(dir $(GOMAKE_MAKEFILE))) | ||
|
||
|
@@ -211,7 +211,7 @@ DELIVERY_REGEX ?= (cdp-runtime\/go-|go-version: \^?)[0-9.]* | |
|
||
# Setup default git command and repository information. | ||
GIT ?= git | ||
GITHOOKS ?= pre-commit commit-msg | ||
GITHOOKS ?= pre-commit # commit-msg | ||
GITAUTHOR ?= $$(echo -n "$$(git config --get user.name) <$$(git config --get user.email)>") | ||
GITREPO ?= $(shell $(GIT) remote get-url origin 2>/dev/null | \ | ||
sed "s/^https:\/\///; s/^git@//; s/.git$$//; s/:/\//") | ||
|
@@ -523,23 +523,23 @@ git-verify = awk -v mode="$(1)" -v author="$(GITAUTHOR)" ' \ | |
function verify() { \ | ||
title = (i = index(msg,"\n")) ? substr(msg, 0, i - 1) : msg; \ | ||
if (title !~ re_type_missing) { \ | ||
printf("$(call merror,commit type missing [title=%s])\n", title); error++ \ | ||
printf("$(call merror,commit type missing [title=%s])\n", title); errors++ \ | ||
} else if (title !~ re_type_invalid) { \ | ||
printf("$(call merror,commit type invalid [title=%s])\n", title); error++ \ | ||
printf("$(call merror,commit type invalid [title=%s])\n", title); errors++ \ | ||
} \ | ||
if (title !~ re_issue_missing) { \ | ||
printf("$(call merror,issue missing [titel=%s])\n", title); error++ \ | ||
printf("$(call merror,issue missing [titel=%s])\n", title); errors++ \ | ||
} else if (title !~ re_issue_invalid) { \ | ||
printf("$(call merror,issue invalid [titel=%s])\n", title); error++ \ | ||
printf("$(call merror,issue invalid [titel=%s])\n", title); errors++ \ | ||
} \ | ||
sign = (i = index(msg, signed_by)) ? substr(msg, i) : ""; \ | ||
if (sign !~ re_signed_missing) { \ | ||
printf("$(call merror,signed-off-by missing [msg=%s])\n", msg); error++ \ | ||
printf("$(call merror,signed-off-by missing [msg=%s])\n", msg); errors++ \ | ||
} else if (sign !~ "^" re_signed_missing) { \ | ||
printf("$(call merror,signed-off-by by to many [sign=%s])\n", sign); error++ \ | ||
printf("$(call merror,signed-off-by by to many [sign=%s])\n", sign); errors++ \ | ||
} else if (mode == "message" && sign !~ re_signed_author) { \ | ||
printf("$(call merror,signed-off-by not the author \ | ||
[sign=%s; author=%s])\n", sign, author); error++ \ | ||
[sign=%s; author=%s])\n", sign, author); errors++ \ | ||
} msg = "" \ | ||
} \ | ||
(mode == "message") { \ | ||
|
@@ -553,7 +553,13 @@ git-verify = awk -v mode="$(1)" -v author="$(GITAUTHOR)" ' \ | |
} else { msg = substr($$0, 5) } next \ | ||
} \ | ||
(mode != "message") { if (msg) { verify(); } } \ | ||
END { verify(); if (error) { exit 1 } }' | ||
END { \ | ||
verify(); if (errors) { \ | ||
printf("$(call mfailure,git-verify $(RUNARGS) [errors=%d])\n", \ | ||
errors); exit 1 \ | ||
} \ | ||
printf("$(call msuccess,git-verify $(RUNARGS) [errors=%d])\n", errors) \ | ||
}' | ||
|
||
#@ prints the git log as pretty graph. | ||
git-graph:: | ||
|
@@ -573,15 +579,14 @@ git-reset:: | |
$(GIT) pull && $(GIT) stash apply \ | ||
) \ | ||
fi || exit 1; $(call git-clean,$${MAIN}); | ||
#@ check whether git log is compliant with conventional commit messages and signed. | ||
#@ <mode> [msg|log-file] # checks whether git log follows the commit conventions. | ||
git-verify:: | ||
@MODE="$(firstword $(RUNARGS))"; case "$${MODE}" in \ | ||
( "log" ) cat "$(wordlist 2,$(words $(RUNARGS)),$(RUNARGS))";; \ | ||
( "message" ) cat "$(wordlist 2,$(words $(RUNARGS)),$(RUNARGS))";; \ | ||
( "pull" ) BRANCH="$$($(GITBRANCH))"; TARGET="$(git-main)"; \ | ||
$(GIT) log --no-merges --format=raw $${BRANCH} ^$${TARGET};; \ | ||
( "branch" ) BRANCH="$$($(GITBRANCH))"; \ | ||
$(GIT) log --no-merges --format=raw $${BRANCH};; \ | ||
( "branch" ) $(GIT) log --no-merges --format=raw "$$($(GITBRANCH))";; \ | ||
( "pull" | * ) MAIN="origin/$(git-main)" $(GIT) fetch --verbose "$${MAIN}" && \ | ||
$(GIT) log --no-merges --format=raw "$$($(GITBRANCH))" "^$${MAIN}";; \ | ||
esac | $(call git-verify,$${MODE}) >/dev/stderr | ||
|
||
#@ <branch> <message> # creates a branch with the current change set using next issue. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ | |
[1;91merror:[0m signed-off-by missing [msg=feat[service]!: initial commit (#11)] | ||
[1;91merror:[0m signed-off-by by to many [sign=Signed-off-by: John Doe <[email protected]> | ||
Signed-off-by: John Doe <[email protected]>] | ||
[1;91mfailure:[0m git-verify log ../internal/make/fixtures/git-verify/log-all.in [errors=13] | ||
make: *** [go-make/config/Makefile.base: git-verify] Error 1 | ||
error: execute make: call failed [path=go-make/run, call=[make --file go-make/config/Makefile.base --no-print-directory git-verify log ../internal/make/fixtures/git-verify/log-all.in]]: exit status 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
[1;91merror:[0m commit type missing [title=feat(wrong): all is somehow wrong (org#1)] | ||
[1;91merror:[0m issue missing [titel=feat(wrong): all is somehow wrong (org#1)] | ||
[1;91merror:[0m signed-off-by not the author [sign=Signed-off-by: Alice Doe <[email protected]>; author=John Doe <[email protected]>] | ||
[1;91mfailure:[0m git-verify message ../internal/make/fixtures/git-verify/msg-failed.in [errors=3] | ||
make: *** [go-make/config/Makefile.base: git-verify] Error 1 | ||
error: execute make: call failed [path=go-make/run, call=[make --file go-make/config/Makefile.base --no-print-directory git-verify message ../internal/make/fixtures/git-verify/msg-failed.in]]: exit status 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
[1;97minfo:[0m captured arguments [message ../internal/make/fixtures/git-verify/msg-okay.in] | ||
[1;92msuccess:[0m git-verify message ../internal/make/fixtures/git-verify/msg-okay.in [errors=0] |