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
1010cppsm add requires https://github.com/per-framework/dumpster.cpp.git v1
1111cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
1212
13+ cppsm upgrade
14+
1315cppsm list
1416
1517cppsm 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
2323fi
2424
2525N_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 3939 EXISTING=" $DESIRED "
4040fi
4141
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" )
4848 " $CPPSM /commands/add" " $KIND " " $SUBMODULE_URL " " $SUBMODULE_BRANCH "
4949done
Original file line number Diff line number Diff line change @@ -24,13 +24,7 @@ tree() {
2424 local PARENT=" $5 "
2525
2626 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 "
3428
3529 if [ 0 = ${# KEYS[@]} ]; then
3630 CONNECT=' ─'
@@ -58,8 +52,6 @@ tree() {
5852
5953 for (( i = 0 ; i < ${# KEYS[@]} ; ++ i)) ; do
6054 SUB=${KEYS[$i]}
61- SUB=" ${SUB% .path} "
62- SUB=" ${SUB# submodule.} "
6355
6456 KEY=" ${SUB#*/ } "
6557
Original file line number Diff line number Diff line change 1717git pull " ${GIT_QUIET[@]} " --rebase
1818
1919MODULES=(.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'
2621
2722git submodule " ${GIT_QUIET[@]} " update --jobs " $N_PARALLEL_UPDATE " --init -- " ${MODULES[@]} "
Original file line number Diff line number Diff line change 1515fi
1616
1717MODULES=(.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'
2419
2520git submodule " ${GIT_QUIET[@]} " update --jobs " $N_PARALLEL_UPDATE " --remote -- " ${MODULES[@]} "
2621git add " ${MODULES[@]} "
You can’t perform that action at this time.
0 commit comments