Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #109 from bergwolf/githooks
Browse files Browse the repository at this point in the history
Makefile: remove git hooks
  • Loading branch information
bergwolf authored Mar 24, 2018
2 parents ce75505 + a679fe9 commit 1846624
Showing 1 changed file with 1 addition and 55 deletions.
56 changes: 1 addition & 55 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,9 @@ define SHOW_ARCH
$(shell printf "\\t%s%s\\\n" "$(1)" $(if $(filter $(ARCH),$(1))," (default)",""))
endef

# Only install git hooks if working in a git clone
ifneq (,$(call DIR_EXISTS,.git))
HANDLE_GIT_HOOKS = install-git-hooks
endif

# Don't install hooks when running under the CI as they will stop the
# tests from running.
#
# See: https://github.com/clearcontainers/runtime/issues/984
ifneq (,$(CI))
HANDLE_GIT_HOOKS =
endif

all: runtime

runtime: $(TARGET_OUTPUT) $(CONFIG) $(HANDLE_GIT_HOOKS)
runtime: $(TARGET_OUTPUT) $(CONFIG)
.DEFAULT: default

build: default
Expand Down Expand Up @@ -314,7 +301,6 @@ $(TARGET_OUTPUT): $(EXTRA_DEPS) $(SOURCES) $(GENERATED_GO_FILES) $(GENERATED_FIL
coverage \
default \
install \
install-git-hooks \
show-header \
show-summary \
show-variables
Expand Down Expand Up @@ -450,43 +436,3 @@ show-summary: show-header
@printf "\tassets path (PKGDATADIR) : %s\n" $(PKGDATADIR)
@printf "\tproxy+shim path (PKGLIBEXECDIR) : %s\n" $(PKGLIBEXECDIR)
@printf "\n"


# The following git hooks handle HEAD changes:
# post-checkout <prev_head> <new_head> <file_or_branch_checkout>
# post-commit # no parameters
# post-merge <squash_or_not>
# post-rewrite <amend_or_rebase>
#
define GIT_HOOK_POST_CHECKOUT
#!/usr/bin/env bash
prev_head=$$1
new_head=$$2
[[ "$$prev_head" == "$$new_head" ]] && exit
printf "\nexecuting post-checkout git hook\n\n"
rm -f $(GENERATED_CONFIG)
endef
export GIT_HOOK_POST_CHECKOUT

define GIT_HOOK_POST_GENERIC
#!/usr/bin/env bash
printf "\n executing $$0 git hook\n\n"
rm -f $(GENERATED_CONFIG)
endef
export GIT_HOOK_POST_GENERIC

# This git-hook is executed after every checkout git operation
.git/hooks/post-checkout: Makefile
@ mkdir -p .git/hooks/
$(QUIET_INST)echo "$$GIT_HOOK_POST_CHECKOUT" >$@
@ chmod +x $@

# This git-hook is executed after every commit, merge, amend or rebase git
# operation
.git/hooks/post-commit .git/hooks/post-merge .git/hooks/post-rewrite: Makefile
@ mkdir -p .git/hooks/
$(QUIET_INST)echo "$$GIT_HOOK_POST_GENERIC" >$@
@ chmod +x $@

install-git-hooks: .git/hooks/post-checkout .git/hooks/post-commit \
.git/hooks/post-merge .git/hooks/post-rewrite

0 comments on commit 1846624

Please sign in to comment.