64
64
# on a new branch named "mcp_main" to avoid modifying the
65
65
# original contents of the source repository to be cloned.
66
66
#
67
+ # -g SGROUP (subgroup) is optional. This is used to select a pre-
68
+ # existing subgroup in the Unity group of the Unity MCP GitLab
69
+ # account. If provided, the remote repository will be cloned
70
+ # in the specified subgroup. If not provided, the remote repo.
71
+ # will be cloned directly inside the Unity group.
72
+ #
67
73
# WARNING:
68
74
# - There is no strong error checking implemented yet.
69
75
# - There are no prompts to confirm the users actions yet.
87
93
# Prints usage message
88
94
#
89
95
usage () {
90
- echo " Usage: $0 [ PATH ] [ -b BRANCH ] [ -m MESSAGE ] [ -t TOKEN_NAME:TOKEN ] [ -p PIPELINE ]" 1>&2
96
+ echo " Usage: $0 [ PATH ] [ -b BRANCH ] [ -m MESSAGE ] [ -t TOKEN_NAME:TOKEN ] [ -p PIPELINE ] [ -g SGROUP ] " 1>&2
91
97
}
92
98
93
99
# This function is for error exit.
@@ -106,12 +112,13 @@ branch="main"
106
112
message=" initial revision"
107
113
tauthentication=" "
108
114
pipeline=" "
115
+ sgroup=" "
109
116
110
117
ipos=0
111
118
while [ $# -gt 0 ]; do
112
119
unset OPTIND
113
120
unset OPTARG
114
- while getopts hb:m:t:p: opt; do
121
+ while getopts hb:m:t:p:g: opt; do
115
122
if [[ ${OPTARG} =~ ^-.* $ ]]; then
116
123
echo " ERROR: Option argument cannot start with '-'"
117
124
exit_abnormal
@@ -122,6 +129,7 @@ while [ $# -gt 0 ]; do
122
129
m) message=${OPTARG} ;;
123
130
t) tauthentication=${OPTARG} ;;
124
131
p) pipeline=` realpath ${OPTARG} ` ;;
132
+ g) sgroup=${OPTARG} ;;
125
133
* ) echo " ERROR: Unknown option." ; exit_abnormal;;
126
134
esac
127
135
done
@@ -144,6 +152,7 @@ echo "branch '$branch'"
144
152
echo " message '$message '"
145
153
echo " token '$tauthentication '"
146
154
echo " pipeline '$pipeline '"
155
+ echo " sgroup '$sgroup '"
147
156
echo " path '$path '"
148
157
149
158
@@ -323,6 +332,10 @@ if [ -z "$result" ]; then
323
332
gitlaburl=" https://$tauthentication @gitlab.mcp.nasa.gov/unity/"
324
333
fi
325
334
335
+ if [ -n " $sgroup " ]; then
336
+ gitlaburl=" $gitlaburl$sgroup /"
337
+ fi
338
+
326
339
# The current subdirectory name (last token of PWD) is
327
340
# chosen as the project name.
328
341
#
0 commit comments