File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 8
8
readonly template=$( mktemp -d /tmp/post-clone.XXXXX)
9
9
10
10
teardown () {
11
- rm -rf ${template}
11
+ rm -rf " ${template} "
12
12
}
13
13
trap teardown EXIT
14
14
15
15
init () {
16
- cd ${template}
16
+ cd " ${template} "
17
17
git init
18
18
git remote add origin https://github.com/git-hook/post-clone.git
19
19
git fetch origin
@@ -22,7 +22,7 @@ init() {
22
22
}
23
23
24
24
main () {
25
- git clone --template=${template} " $@ "
25
+ git clone --template=" ${template} " " $@ "
26
26
}
27
27
28
28
init & > /dev/null
Original file line number Diff line number Diff line change 5
5
# This hook can be used to save metadata about where a git repository
6
6
# is cloned locally. The intent is to use this information in other
7
7
# scripts that operate on the cloned git repository.
8
-
9
8
# path to the newly cloned repo on disk
9
+
10
10
readonly repo=$( git rev-parse --show-toplevel)
11
11
12
12
main () {
13
- rm -rf -- ${repo} /.git/hooks
13
+ rm -rf -- " ${repo} /.git/hooks"
14
+ initializeSubmodules
14
15
installClonedReposHooks
15
16
invokeClonedReposPostCloneHook
16
17
}
17
18
19
+ initializeSubmodules () {
20
+ git submodule update --init --recursive
21
+ }
22
+
18
23
installClonedReposHooks () {
19
- cd ${repo} /.git
24
+ cd " ${repo} /.git"
20
25
rm -rf hooks
21
26
ln -sf ../hooks
22
27
cd - > /dev/null
23
28
}
24
29
25
30
invokeClonedReposPostCloneHook () {
26
- local -r post_clone_hook=${repo} /.git/hooks/post-clone
27
- test ! -e ${post_clone_hook} && return
28
- chmod u+x ${post_clone_hook}
31
+ local -r post_clone_hook=" ${repo} /.git/hooks/post-clone"
32
+ test ! -e " ${post_clone_hook} " && return
33
+ chmod u+x " ${post_clone_hook} "
29
34
${post_clone_hook}
30
35
}
31
36
You can’t perform that action at this time.
0 commit comments