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 88readonly template=$( mktemp -d /tmp/post-clone.XXXXX)
99
1010teardown () {
11- rm -rf ${template}
11+ rm -rf " ${template} "
1212}
1313trap teardown EXIT
1414
1515init () {
16- cd ${template}
16+ cd " ${template} "
1717 git init
1818 git remote add origin https://github.com/git-hook/post-clone.git
1919 git fetch origin
@@ -22,7 +22,7 @@ init() {
2222}
2323
2424main () {
25- git clone --template=${template} " $@ "
25+ git clone --template=" ${template} " " $@ "
2626}
2727
2828init & > /dev/null
Original file line number Diff line number Diff line change 55# This hook can be used to save metadata about where a git repository
66# is cloned locally. The intent is to use this information in other
77# scripts that operate on the cloned git repository.
8-
98# path to the newly cloned repo on disk
9+
1010readonly repo=$( git rev-parse --show-toplevel)
1111
1212main () {
13- rm -rf -- ${repo} /.git/hooks
13+ rm -rf -- " ${repo} /.git/hooks"
14+ initializeSubmodules
1415 installClonedReposHooks
1516 invokeClonedReposPostCloneHook
1617}
1718
19+ initializeSubmodules () {
20+ git submodule update --init --recursive
21+ }
22+
1823installClonedReposHooks () {
19- cd ${repo} /.git
24+ cd " ${repo} /.git"
2025 rm -rf hooks
2126 ln -sf ../hooks
2227 cd - > /dev/null
2328}
2429
2530invokeClonedReposPostCloneHook () {
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} "
2934 ${post_clone_hook}
3035}
3136
You can’t perform that action at this time.
0 commit comments