-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented #139: Add installing for submodules
- (It must be ran from the root git directory.)
- Loading branch information
Showing
1 changed file
with
34 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,34 @@ | ||
#!/usr/bin/env bash | ||
: <<'LCS' | ||
/** | ||
* @license https://raw.githubusercontent.com/andkirby/commithook/master/LICENSE.md | ||
*/ | ||
LCS | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
#set -o xtrace | ||
|
||
# Set magic variables for current file & dir | ||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")" | ||
readonly __dir __file | ||
|
||
if commithook 2>&1 > /dev/null; then | ||
commithook_bin=$(type commithook | awk '{print $NF}' | tr -d "'\`") | ||
else | ||
commithook_bin=${__dir}/../../bin/commithook | ||
fi | ||
|
||
current_pwd=$(pwd) | ||
|
||
submodule_paths() { | ||
cat ${current_pwd}/.gitmodules \ | ||
| grep 'path = ' | awk '{print $3}' | ||
} | ||
|
||
while read module_path; do | ||
cd ${module_path} | ||
${commithook_bin} install | ||
done < <(submodule_paths) |