Relocate the python file under appropriate hierarchy
[git-modules-bs.git] / git-modules
blob977ba6e72e758a9d02df8cd2a58cbf1915f7632d
1 #!/bin/sh
3 ARGS=1
4 if [ $# -lt "$ARGS" ]; then
5 echo Not enough arguments.
6 echo Example \"\<this script\> status\" for \"git-status\" - git-modules status
7 exit 65;
8 fi
10 initializeSubModule() {
11 if [ ! -d "$1"/.git ]; then
12 echo Initializing and updating "$1"
13 git-submodule init "$1"; git-submodule update "$1"
17 traverseModule() {
18 current_dir=`pwd`
19 dir_path="$current_dir:$dir_path"
20 initializeSubModule "$1"
21 cd "$1"
22 echo Working in mod $1 @ `pwd` with $2
23 eval "$2"
24 if [ -f .gitmodules ]; then
25 for mod_path in `grep "path =" .gitmodules | awk '{print $3}'`; do
26 traverseModule "$mod_path" "$2"
27 done
29 old_dir=$(echo $dir_path | cut -d':' -f1-1)
30 length_old_dir=`expr "$old_dir" : '.*'`
31 cd $old_dir
32 index=$(echo "$length_old_dir+2" | bc)
33 dir_path=`echo $dir_path $index | awk '{print substr($1, $2)}'`
36 initSubModules() {
37 current_dir=`pwd`
38 dir_path="$current_dir:$dir_path"
39 initializeSubModule "$1"
40 cd "$1"
41 echo Working in mod $1 @ `pwd`
42 if [ -f .gitmodules ]; then
43 for mod_path in `grep "path =" .gitmodules | awk '{print $3}'`; do
44 initSubModules "$mod_path"
45 done
47 old_dir=$(echo $dir_path | cut -d':' -f1-1)
48 length_old_dir=`expr "$old_dir" : '.*'`
49 cd $old_dir
50 index=$(echo "$length_old_dir+2" | bc)
51 dir_path=`echo $dir_path $index | awk '{print substr($1, $2)}'`
54 propagate() {
55 project_home=`pwd`
56 echo Project Home: $project_home
57 if [ -d $project_home/.git/ ]; then
58 git_command=$1
59 shift
60 command_arguments=""
61 for arg in "$@"; do
62 if [ `expr index "$arg" ' '` -gt 0 ]; then
63 arg="\"$arg\""
64 fi
65 command_arguments="$command_arguments $arg"
66 done
67 echo GIT Command git-$git_command with arguments\($#\) "$command_arguments"
68 main_command="git-$git_command $command_arguments"
69 eval $main_command
70 if [ -f .gitmodules ]; then
71 for mod_path in `grep "path =" .gitmodules | awk '{print $3}'`; do
72 traverseModule $mod_path "$main_command"
73 done
75 else
76 echo $project_home not a git repo thus exiting
77 exit
81 propagate "$@"