-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Copyright 2018 the authors. See the 'Copyright and license' section of the | ||
README.md file at the top-level directory of this repository. | ||
Licensed under the Apache License, Version 2.0 (the LICENSE-APACHE file) or | ||
the MIT license (the LICENSE-MIT file) at your option. This file may not be | ||
copied, modified, or distributed except according to those terms. --> | ||
|
||
# Git Hooks | ||
|
||
This directory contains hooks which git will execute at various times. To | ||
install the hooks, run `./install-hooks.sh`. |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 the authors. See the 'Copyright and license' section of the | ||
# README.md file at the top-level directory of this repository. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the LICENSE-APACHE file) or | ||
# the MIT license (the LICENSE-MIT file) at your option. This file may not be | ||
# copied, modified, or distributed except according to those terms. | ||
|
||
# source: http://stackoverflow.com/a/957978/836390 | ||
ROOT=$(git rev-parse --show-toplevel) || exit 1 | ||
|
||
if [ "$ROOT" == "" ]; then | ||
echo "`git rev-parse --show-toplevel` returned empty root path" >&2 | ||
exit 1 | ||
fi | ||
|
||
cd $ROOT/.git/hooks || exit 1 | ||
|
||
ln -s ../../git-hooks/pre-commit.sh pre-commit || exit 1 |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 the authors. See the 'Copyright and license' section of the | ||
# README.md file at the top-level directory of this repository. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the LICENSE-APACHE file) or | ||
# the MIT license (the LICENSE-MIT file) at your option. This file may not be | ||
# copied, modified, or distributed except according to those terms. | ||
|
||
echo "Executing pre-commit hooks..." | ||
|
||
# source: http://stackoverflow.com/a/957978/836390 | ||
ROOT="$(git rev-parse --show-toplevel)" || exit 1 | ||
|
||
if [ "$ROOT" == "" ]; then | ||
echo "`git rev-parse --show-toplevel` returned empty root path" >&2 | ||
exit 1 | ||
fi | ||
|
||
cd "$ROOT" | ||
|
||
function die { | ||
if [ $# -eq 1 ]; then | ||
rm "$1" | ||
fi | ||
echo "commit aborted" >&1 | ||
exit 1 | ||
} | ||
|
||
echo " Running ./test-scripts/check-copyright-comments.sh..." | ||
./test-scripts/check-copyright-comments.sh |