Skip to content

Commit 97bb065

Browse files
committedJan 14, 2021
remove debug mode added prompt for git repo directory
1 parent 8fd61d1 commit 97bb065

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
 

‎pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -x
2+
#set -x
33

44
########################################################
55

‎setup_pre_commit_hook.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
if [ "$1" == "" ]; then
4+
echo "Please specify your git repo directory to install the hook"
5+
exit 1
6+
else
7+
GIT_REPO_DIR="$1"
8+
fi
39

410
echo "Enable git templates"
511
git config --global init.templatedir "$HOME/.git-templates"
@@ -11,9 +17,10 @@ cp pre-push ~/.git-templates/hooks
1117

1218
#DIR="~/" # for production
1319
#DIR="/tmp/" # for testing
14-
echo -e "\nFind all the git repos under $DIR directory"
20+
echo -e "\nFind all the git repos under $GIT_REPO_DIR directory"
1521
#ALL_GIT_REPOS=$(find ~/ -name .git | sed 's/\.git//g')
16-
ALL_GIT_REPOS=$(find /tmp/ -name .git | sed 's/\.git//g')
22+
#ALL_GIT_REPOS=$(find /tmp/ -name .git | sed 's/\.git//g')
23+
ALL_GIT_REPOS=$(find $GIT_REPO_DIR -name .git | sed 's/\.git//g')
1724

1825
for repo in $ALL_GIT_REPOS; do
1926
echo -e "\nRunning git init on $repo under $DIR to copy the global hook";

0 commit comments

Comments
 (0)
Please sign in to comment.