-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-git-all.sh
executable file
·69 lines (61 loc) · 2.46 KB
/
dev-git-all.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# This file is part of the SavaPage project <https://www.savapage.org>.
# Copyright (c) 2011-2020 Datraverse B.V.
# Author: Rijk Ravestein.
#
# SPDX-FileCopyrightText: 2011-2020 Datraverse B.V. <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# For more information, please contact Datraverse B.V. at this
# address: [email protected]
#
#------------------------------------------------------------------------------
# Executes a git command for all repositories
#
# All command line options are passed in one (1) string.
#------------------------------------------------------------------------------
_CLI_OPTIONS=$1
#--------------------------------------------------------------------
# Get the absolute path of this (symlinked) file
#--------------------------------------------------------------------
SP_SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SP_SELF_PATH=$SP_SELF_PATH/$(basename -- "$0")
# resolve symlinks
while [ -h $SP_SELF_PATH ]; do
# 1) cd to directory of the symlink
# 2) cd to the directory of where the symlink points
# 3) get the pwd
# 4) append the basename
SP_DIR=$(dirname -- "$SP_SELF_PATH")
SP_SYM=$(readlink $SP_SELF_PATH)
SP_SELF_PATH=$(cd $SP_DIR && cd $(dirname -- "$SP_SYM") && pwd)/$(basename -- "$SP_SYM")
done
_CURRENTDIR=`dirname ${SP_SELF_PATH}`
#--------------------------------------------------------------------
. ${_CURRENTDIR}/dev-settings
#--------------------------------------------------------------------
cd ${_CURRENTDIR}/..
readonly REPOS="$(find . -mindepth 1 -maxdepth 1 -type d)"
for repo in $REPOS
do
echo git ${_CLI_OPTIONS} in public git repository \[${repo}\] ...
cd ${repo}
git ${_CLI_OPTIONS}
cd ..
done
#--------------------------------------------------------------------
cd ${_CURRENTDIR}
# end-of-file