1
1
#! /usr/bin/env bash
2
2
3
+ function get_workspace_root() {
4
+ git rev-parse --show-toplevel
5
+ }
6
+
3
7
function get_repos_file_path() {
4
- echo " $( git rev-parse --show-toplevel ) /autoware.proj.repos"
8
+ echo " $( get_workspace_root ) /autoware.proj.repos"
5
9
}
6
10
7
11
function install_yq_if_not_installed() {
@@ -147,13 +151,13 @@ function update_workspace() {
147
151
function update_version_in_repos() {
148
152
repository=" $1 "
149
153
if [ " $repository " = " " ]; then
150
- echo -e " Please input a repository name as the 1st argument"
154
+ echo -e " Please input a repository name as the 1st argument. "
151
155
return 1
152
156
fi
153
157
154
158
version=" $2 "
155
159
if [ " $version " = " " ]; then
156
- echo -e " Please input a version as the 2nd argument"
160
+ echo -e " Please input a version as the 2nd argument. "
157
161
return 1
158
162
fi
159
163
@@ -197,17 +201,17 @@ function create_branch() {
197
201
git_command=" git --work-tree=$repository --git-dir=$repository /.git"
198
202
199
203
if [ " $flag_delete " ]; then
200
- echo -e " Delete branch \" $branch_name \" in \" $repository \" "
204
+ echo -e " Delete branch \" $branch_name \" in \" $repository \" . "
201
205
$git_command checkout --detach --quiet HEAD
202
206
$git_command branch -D --quiet " $branch_name "
203
207
return 0
204
208
fi
205
209
206
- echo -e " Create branch \" $branch_name \" in \" $repository \" "
210
+ echo -e " Create branch \" $branch_name \" in \" $repository \" . "
207
211
$git_command checkout --quiet -b " $branch_name " || exit 1
208
212
209
213
if [ " $flag_push " ]; then
210
- echo -e " Push branch \" $branch_name \" to \" $repository \" "
214
+ echo -e " Push branch \" $branch_name \" to \" $repository \" . "
211
215
$git_command push origin " $branch_name "
212
216
fi
213
217
@@ -223,17 +227,17 @@ function create_tag() {
223
227
git_command=" git --work-tree=$repository --git-dir=$repository /.git"
224
228
225
229
if [ " $flag_delete " ]; then
226
- echo -e " Delete tag \" $version \" in \" $repository \" "
230
+ echo -e " Delete tag \" $version \" in \" $repository \" . "
227
231
$git_command tag -d " $version " > /dev/null
228
232
return 0
229
233
fi
230
234
231
- echo -e " Create tag \" $version \" in \" $repository \" "
235
+ echo -e " Create tag \" $version \" in \" $repository \" . "
232
236
$git_command checkout --detach --quiet HEAD
233
237
$git_command tag -a " $version " -m " $version " || exit 1
234
238
235
239
if [ " $flag_push " ]; then
236
- echo -e " Push tag \" $version \" to \" $repository \" "
240
+ echo -e " Push tag \" $version \" to \" $repository \" . "
237
241
$git_command push origin " $version "
238
242
fi
239
243
@@ -246,7 +250,7 @@ function checkout_branch_or_tag() {
246
250
247
251
git_command=" git --work-tree=$repository --git-dir=$repository /.git"
248
252
249
- echo -e " Checkout \" $branch_or_tag_name \" in \" $repository \" "
253
+ echo -e " Checkout \" $branch_or_tag_name \" in \" $repository \" . "
250
254
$git_command checkout --quiet " $branch_or_tag_name " || exit 1
251
255
252
256
return 0
0 commit comments