-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6 Change main to run command as external file
- Loading branch information
askirmas
committed
Nov 29, 2019
1 parent
a9101fa
commit de02545
Showing
5 changed files
with
23 additions
and
30 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,16 @@ | ||
#!/bin/bash | ||
MY_DIR=$(dirname "$(realpath "$0")") | ||
HOOKS_PATH="${1:-git-hooks}" | ||
|
||
echo -n "$HOOKS_PATH" > "$MY_DIR/hooks_dir" | ||
|
||
git config --local core.hooksPath "$MY_DIR" | ||
CORE=$(git config --local --get core.hooksPath) | ||
if [ "$CORE" == "$MY_DIR" ] | ||
then | ||
echo "Wrapped git hooks in folder '$HOOKS_PATH'" | ||
exit 0 | ||
else | ||
echo "Something went wrong. Run manually: git config --local core.hooksPath \"$MY_DIR\"" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.
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,12 +1,6 @@ | ||
#!/bin/bash | ||
MY_DIR=$(dirname "$(realpath "$0")") | ||
|
||
case "$1" in | ||
--pre-commit) | ||
$MY_DIR/hooks/pre-commit | ||
;; | ||
*) | ||
$MY_DIR/hooks/init.sh "$@" | ||
;; | ||
esac | ||
CMD="$1"; shift | ||
test -e "$MY_DIR/hooks/$CMD" && ($MY_DIR/hooks/$CMD $@; exit $?) | ||
test -e "$MY_DIR/scripts/$CMD.sh" && ($MY_DIR/scripts/$CMD.sh $@; exit $?) | ||
exit $? |
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