New git utility script
[skip ci]
This commit is contained in:
parent
e94ddee69c
commit
fbd8937762
|
@ -1 +1 @@
|
||||||
Subproject commit 9fa1c0ea978c19c22e45db00643c0b5683430cc7
|
Subproject commit d4a5b65dd9a5460d41fb293cb4a77fc3381bcfab
|
43
mk/linux/mg_git.sh
Executable file
43
mk/linux/mg_git.sh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 'Usage:'
|
||||||
|
echo "$(basename $0)"' <COMMAND>'
|
||||||
|
echo
|
||||||
|
echo 'COMMAND is a standard git command, e.g. "pull" to run "git pull"'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
|
||||||
|
pull )
|
||||||
|
echo '==> Running "git '"$1"'" on main repository...'
|
||||||
|
cd $(dirname $0)
|
||||||
|
git $1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'Error: Failed to run "git '"$1"'" on main repository.' >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo '==> Running "git '"$1"'" on submodules...'
|
||||||
|
git submodule foreach git $1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'Error: Failed to run "git '"$1"'" on submodules.' >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
'' )
|
||||||
|
echo 'Error: No command was provided.'"$1" >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
* )
|
||||||
|
echo 'Error: Unknown command: '"$1" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user