Skip to content

Commit d99c39a

Browse files
committed
small fixups and misunderstandings about nested submodules
1 parent 1bead5a commit d99c39a

File tree

6 files changed

+76
-7
lines changed

6 files changed

+76
-7
lines changed

clone.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ do
3030
sayAndDo git checkout --track $remote
3131
done
3232
sayAndDo git checkout master
33-
sayAndDo git submodule foreach 'git checkout master'
33+
sayAndDo git submodule init
34+
sayAndDo git submodule update --init --recursive
3435
cd ..
3536
echo
3637
fi

create.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2014 Range Networks, Inc.
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Affero General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Affero General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Affero General Public License
16+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
# See the COPYING file in the main directory for details.
18+
#
19+
20+
source $(dirname $0)/common.source
21+
22+
usage () {
23+
echo "# usage: ./create.sh component-directory (tag/branch name)"
24+
exit 1
25+
}
26+
27+
# What component do we want to manipulate?
28+
if [ -z "$1" ]; then
29+
usage
30+
elif [ ! -d $1 ]; then
31+
usage
32+
else
33+
COMPONENT=$1
34+
fi
35+
36+
# Are we adding a creating or branch?
37+
if [ -z "$2" ]; then
38+
read -r -p "# Do you want to create a tag or branch? " TYPE
39+
elif [ $2 == "tag" ]; then
40+
TYPE="tag"
41+
elif [ $2 == "branch" ]; then
42+
TYPE="branch"
43+
else
44+
usage
45+
fi
46+
47+
# Which one should be created?
48+
if [ -z "$3" ]; then
49+
read -r -p "# What new $TYPE would you like to create? " NAME
50+
else
51+
NAME=$3
52+
fi
53+
54+
# Really, truly? Alrighty, execute.
55+
read -r -p "# To create a new $TYPE named $NAME, answer \"yes\" " ANSWER
56+
if [ $ANSWER == "yes" ]; then
57+
cd $COMPONENT
58+
if [ $TYPE == "tag" ]; then
59+
echo "# Sorry, tag creations haven't been implemented. Bailing."
60+
exit 1
61+
elif [ $TYPE == "branch" ]; then
62+
echo "# - creating..."
63+
sayAndDo git checkout -b $NAME
64+
echo "# - pushing to origin..."
65+
sayAndDo git push -u origin $NAME
66+
fi
67+
else
68+
echo "# - better safe than sorry, cancelling..."
69+
fi

delete.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
source $(dirname $0)/common.source
2121

2222
usage () {
23-
echo "# usage: ./delete.sh component-directory (tag/branch current-tag new-tag)"
23+
echo "# usage: ./delete.sh component-directory (tag/branch name)"
2424
exit 1
2525
}
2626

pull.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ do
2525
echo "# pulling $component"
2626
cd $component
2727
sayAndDo git pull
28-
sayAndDo git submodule update --remote
29-
sayAndDo git submodule foreach --recursive 'git pull'
28+
sayAndDo git submodule update --recursive
3029
cd ..
3130
echo
3231
fi

rename.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
source $(dirname $0)/common.source
2121

2222
usage () {
23-
echo "# usage: ./rename.sh component-directory (tag/branch current-tag new-tag)"
23+
echo "# usage: ./rename.sh component-directory (tag/branch current-name new-name)"
2424
exit 1
2525
}
2626

switchto.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
source $(dirname $0)/common.source
2121

2222
usage () {
23-
echo "# usage: ./switchto.sh branch-name"
23+
echo "# usage: ./switchto.sh branch-or-tag-name"
2424
exit 1
2525
}
2626

@@ -35,7 +35,7 @@ do
3535
echo "# $component"
3636
cd $component
3737
sayAndDo git checkout $1
38-
sayAndDo git submodule foreach --recursive "git checkout $1"
38+
sayAndDo git submodule update --recursive
3939
cd ..
4040
echo
4141
fi

0 commit comments

Comments
 (0)