Add "gitconfig" make target to simplify gerrit configuration
authorPatrick Georgi <patrick@georgi-clan.de>
Sun, 5 Jun 2011 13:15:49 +0000 (15:15 +0200)
committerPeter Stuge <peter@stuge.se>
Tue, 7 Jun 2011 19:46:08 +0000 (21:46 +0200)
"make gitconfig" installs the gerrit commit-msg hook and validates
that user.name and user.email are configured.

No data will be overwritten.

Change-Id: I49ec98538574866e7ad6238ff3d02b9c1beef1bb
Reviewed-on: http://review.coreboot.org/2
Tested-by: build bot (Jenkins)
Reviewed-by: Peter Stuge <peter@stuge.se>
Makefile.inc

index f8c4deb2acff1e8ed0acc3e11ae0bb2468c39581..72a3b550179261510d4f9dafce6a2efba7088408 100644 (file)
@@ -231,6 +231,10 @@ lint:
        test $$FAILED -eq 0 || { echo "ERROR: $$FAILED test(s) failed." &&  exit 1; }; \
        rm -f $$LINTLOG
 
+gitconfig:
+       if ! [ -x .git/hooks/commit-msg ]; then wget -O .git/hooks/commit-msg http://review.coreboot.org/tools/hooks/commit-msg; chmod +x .git/hooks/commit-msg; fi
+       (git config --global user.name >/dev/null && git config --global user.email >/dev/null) || (printf 'Please configure your name and email in git:\n\n git config --global user.name "Your Name Comes Here"\n git config --global user.email your.email@example.com\n'; exit 1)
+
 crossgcc: clean-for-update
        $(MAKE) -C util/crossgcc build