diff --git a/make/git-hooks/msg_template.txt b/.commit-template similarity index 65% rename from make/git-hooks/msg_template.txt rename to .commit-template index f2e8c48d6..b24523777 100644 --- a/make/git-hooks/msg_template.txt +++ b/.commit-template @@ -1,23 +1,21 @@ -# # *************** OpenPilot commits guidelines *************** -# -# Before committing, ensure your code is properly formatted -# you can do that using: -# make uncrustify_all -# you can format only flight or ground side code using respectively -# uncrustify_flight or uncrustify_ground -# # Each commit needs to have a message like the following sample: # OP-1150 UI for thermal calibration: Connect State machine to UI # # It needs to begin with a reference to one or more Jira tickets followed by a short description. # If needed add a longer description in the following lines, after an empty line. # +# Before committing, ensure your code is properly formatted using: +# make uncrustify_all +# You can format flight or ground code only using respectively +# uncrustify_flight or uncrustify_ground +# # To automatically create a review, append the following smart commit messages: # +review OPReview # # To append the commit to an existing review, use the following smart commit message: # +review OPReview-NNN -# Where NNN is the id of the review i.e. "+review OPReview-609" -# *NOTE* insert smart commit messages leaving an empty line from the previous text -# starting immediately at first column +# For example "+review OPReview-609" +# +# *NOTE* leave an empty line between the commit message and "smart commit command" +# Smart commits commands need to starts immediately at first column diff --git a/Makefile b/Makefile index 9c7b0789e..5a92d320d 100644 --- a/Makefile +++ b/Makefile @@ -860,7 +860,7 @@ help: @$(ECHO) " Here is a summary of the available targets:" @$(ECHO) @$(ECHO) " [Source tree preparation]" - @$(ECHO) " prepare - Install GIT hooks under the right .git/hooks" + @$(ECHO) " prepare - Install GIT commit message templates" @$(ECHO) " [Tool Installers]" @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" @$(ECHO) " qt_sdk_install - Install the QT development tools" diff --git a/make/git-hooks/prepare-commit-msg b/make/git-hooks/prepare-commit-msg deleted file mode 100755 index 932b838b2..000000000 --- a/make/git-hooks/prepare-commit-msg +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Append instructions on how to format a commit message -cat "$GIT_DIR/hooks/msg_template.txt" >> $1 -# \ No newline at end of file diff --git a/make/tools.mk b/make/tools.mk index 2feee7d5b..ee2e6be11 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -948,12 +948,18 @@ android_sdk_update: $(ANDROID_SDK_DIR)/tools/android update sdk --no-ui -t platform-tools,android-16,addon-google_apis-google-16 #Install git hooks under the right folder -.PHONY: prepare - -prepare: - $(V0) @echo " Installing GIT hooks under $(ROOT_DIR)/.git/hooks" - $(V1) $(CP) --remove-destination "$(ROOT_DIR)/make/git-hooks"/* "$(ROOT_DIR)/.git/hooks/" +.PHONY: prepare +prepare: + $(V0) @echo " Configuring GIT commit template" + $(V1) $(CD) "$(ROOT_DIR)" + $(V1) $(GIT) config commit.template .commit-template + +.PHONY: prepare_clean +prepare_clean: + $(V0) @echo " Cleanup GIT commit template configuration" + $(V1) $(CD) "$(ROOT_DIR)" + $(V1) $(GIT) config --unset commit.template ############################## #