File tree Expand file tree Collapse file tree 6 files changed +33
-27
lines changed Expand file tree Collapse file tree 6 files changed +33
-27
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
10
10
cppsm add requires https://github.com/per-framework/dumpster.cpp.git v1
11
11
cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
12
12
13
+ cppsm upgrade
14
+
13
15
cppsm list
14
16
15
17
cppsm remove requires/polyfill.cpp/v1
Original file line number Diff line number Diff line change @@ -23,3 +23,25 @@ if [ -z "$NUMBER_OF_PROCESSORS" ]; then
23
23
fi
24
24
25
25
N_PARALLEL_UPDATE=" ${N_PARALLEL_UPDATE:- $NUMBER_OF_PROCESSORS } "
26
+
27
+ add-submodule-keys-and-paths-to () {
28
+ local VAR=" $1 "
29
+ local GITMODULES=" $2 "
30
+ local KIND=" $3 "
31
+ shift 3
32
+ local IFS=$' \n '
33
+ for LINE in $( git config \
34
+ --file " $GITMODULES " \
35
+ --get-regexp " ^submodule\.($KIND )/.*\.path$" \
36
+ | sed " $@ " ) ; do
37
+ eval " $VAR +=('$LINE ')"
38
+ done
39
+ }
40
+
41
+ add-submodule-paths-to () {
42
+ add-submodule-keys-and-paths-to " $@ " -e ' s#^.*\.path ##g'
43
+ }
44
+
45
+ add-submodule-keys-to () {
46
+ add-submodule-keys-and-paths-to " $@ " -e ' s#^submodule\.##g' -e ' s#\.path .*$##g'
47
+ }
Original file line number Diff line number Diff line change 39
39
EXISTING=" $DESIRED "
40
40
fi
41
41
42
- for SUBMODULE in $( git config \
43
- --file " $EXISTING /.gitmodules" \
44
- --name-only \
45
- --get-regexp ' ^submodule\.requires/.*\.path$ ' ) ; do
46
- SUBMODULE_URL=$( git config --file " $EXISTING /.gitmodules" --get " ${SUBMODULE % .path} .url" )
47
- SUBMODULE_BRANCH=$( git config --file " $EXISTING /.gitmodules" --get " ${SUBMODULE % .path} .branch" )
42
+ KEYS=()
43
+ add-submodule-keys-to KEYS " $EXISTING /.gitmodules" requires
44
+
45
+ for KEY in " ${KEYS[@]} " ; do
46
+ SUBMODULE_URL=$( git config --file " $EXISTING /.gitmodules" --get " submodule. $KEY .url" )
47
+ SUBMODULE_BRANCH=$( git config --file " $EXISTING /.gitmodules" --get " submodule. $KEY .branch" )
48
48
" $CPPSM /commands/add" " $KIND " " $SUBMODULE_URL " " $SUBMODULE_BRANCH "
49
49
done
Original file line number Diff line number Diff line change @@ -24,13 +24,7 @@ tree() {
24
24
local PARENT=" $5 "
25
25
26
26
local KEYS=()
27
- IFS=$' \n '
28
- for KEY in $( git config \
29
- --file " $GITMODULES " \
30
- --name-only \
31
- --get-regexp " ^submodule\.($KIND )/.*\.path$" ) ; do
32
- KEYS+=(" $KEY " )
33
- done
27
+ add-submodule-keys-to KEYS " $GITMODULES " " $KIND "
34
28
35
29
if [ 0 = ${# KEYS[@]} ]; then
36
30
CONNECT=' ─'
@@ -58,8 +52,6 @@ tree() {
58
52
59
53
for (( i = 0 ; i < ${# KEYS[@]} ; ++ i)) ; do
60
54
SUB=${KEYS[$i]}
61
- SUB=" ${SUB% .path} "
62
- SUB=" ${SUB# submodule.} "
63
55
64
56
KEY=" ${SUB#*/ } "
65
57
Original file line number Diff line number Diff line change 17
17
git pull " ${GIT_QUIET[@]} " --rebase
18
18
19
19
MODULES=(.cppsm)
20
- while IFS=' ' read -r line; do
21
- MODULES+=(" $line " )
22
- done < <( git config \
23
- --file .gitmodules \
24
- --get-regexp " ^submodule\.(equipment|requires)/.*\.path$" \
25
- | sed -e ' s#^.*\.path ##g' )
20
+ add-submodule-paths-to MODULES .gitmodules ' equipment|requires'
26
21
27
22
git submodule " ${GIT_QUIET[@]} " update --jobs " $N_PARALLEL_UPDATE " --init -- " ${MODULES[@]} "
Original file line number Diff line number Diff line change 15
15
fi
16
16
17
17
MODULES=(.cppsm)
18
- while IFS=' ' read -r line; do
19
- MODULES+=(" $line " )
20
- done < <( git config \
21
- --file .gitmodules \
22
- --get-regexp " ^submodule\.(equipment|requires)/.*\.path$" \
23
- | sed -e ' s#^.*\.path ##g' )
18
+ add-submodule-paths-to MODULES .gitmodules ' equipment|requires'
24
19
25
20
git submodule " ${GIT_QUIET[@]} " update --jobs " $N_PARALLEL_UPDATE " --remote -- " ${MODULES[@]} "
26
21
git add " ${MODULES[@]} "
You can’t perform that action at this time.
0 commit comments