make setgitremote configurable with defaults too
This commit is contained in:
parent
d96652835b
commit
13bf8e8458
3 changed files with 26 additions and 7 deletions
|
@ -2,14 +2,16 @@
|
||||||
export MSC_GIT_ALL_LOCAL=true
|
export MSC_GIT_ALL_LOCAL=true
|
||||||
export MSC_GIT_REPO_UPDATE_DEFAULT=true
|
export MSC_GIT_REPO_UPDATE_DEFAULT=true
|
||||||
export MSC_GIT_REPO_UPDATE_INTERVALL_DEFAULT=48 #intervall in hours
|
export MSC_GIT_REPO_UPDATE_INTERVALL_DEFAULT=48 #intervall in hours
|
||||||
export MSC_GIT_REMOTE_NAME_DEFAULT=gitea
|
|
||||||
export MSC_GIT_BRANCH_DEFAULT=master
|
|
||||||
export MSC_GIT_SUBMODULES_UPDATE_DEFAULT=true
|
export MSC_GIT_SUBMODULES_UPDATE_DEFAULT=true
|
||||||
export MSC_GIT_SUBMODULES_UPDATE_INTERVALL_DEFAULT=196 #intervall in hours
|
export MSC_GIT_SUBMODULES_UPDATE_INTERVALL_DEFAULT=196 #intervall in hours
|
||||||
export MSC_GIT_SUBMODULES_SERVER_DEFAULT="git://github.com/"
|
export MSC_GIT_SUBMODULES_SERVER_DEFAULT="git://github.com/"
|
||||||
export MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
|
export MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
|
||||||
export MSC_GIT_TIMEOUT_DEFAULT=5s
|
export MSC_GIT_TIMEOUT_DEFAULT=5s
|
||||||
export MSC_GIT_CHECKOUT_TIMEOUT_DEFAULT=20s
|
export MSC_GIT_CHECKOUT_TIMEOUT_DEFAULT=20s
|
||||||
|
export MSC_GIT_REMOTE_NAME_DEFAULT=gitea
|
||||||
|
export MSC_GIT_BRANCH_DEFAULT=master
|
||||||
|
export MSC_GIT_PULLURL_DEFAULT=https://git.schuerz.at/jakob/myshellconfig.git
|
||||||
|
export MSC_GIT_PUSHURL_DEFAULT=git@git.schuerz.at:jakob/myshellconfig.git
|
||||||
### LOGGING ###
|
### LOGGING ###
|
||||||
# Possible loglevel-values: ERROR, WARN, INFO, DEBUG, TRACE
|
# Possible loglevel-values: ERROR, WARN, INFO, DEBUG, TRACE
|
||||||
export MSC_LOGLEVEL_DEFAULT="WARN"
|
export MSC_LOGLEVEL_DEFAULT="WARN"
|
||||||
|
|
|
@ -8,6 +8,10 @@ export MSC_GIT_SUBMODULES_SERVER_DEFAULT="git://github.com/"
|
||||||
export MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
|
export MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
|
||||||
export MSC_GIT_TIMEOUT_DEFAULT=5s
|
export MSC_GIT_TIMEOUT_DEFAULT=5s
|
||||||
export MSC_GIT_CHECKOUT_TIMEOUT_DEFAULT=20s
|
export MSC_GIT_CHECKOUT_TIMEOUT_DEFAULT=20s
|
||||||
|
export MSC_GIT_REMOTE_NAME_DEFAULT=gitea
|
||||||
|
export MSC_GIT_BRANCH_DEFAULT=master
|
||||||
|
export MSC_GIT_PULLURL_DEFAULT=https://git.schuerz.at/jakob/myshellconfig.git
|
||||||
|
export MSC_GIT_PUSHURL_DEFAULT=git@git.schuerz.at:jakob/myshellconfig.git
|
||||||
### LOGGING ###
|
### LOGGING ###
|
||||||
# Possible loglevel-values: ERROR, WARN, INFO, DEBUG, TRACE
|
# Possible loglevel-values: ERROR, WARN, INFO, DEBUG, TRACE
|
||||||
export MSC_LOGLEVEL_DEFAULT="INFO"
|
export MSC_LOGLEVEL_DEFAULT="INFO"
|
||||||
|
|
23
functions.sh
23
functions.sh
|
@ -1338,11 +1338,24 @@ setserver() {
|
||||||
|
|
||||||
setgitremote() {
|
setgitremote() {
|
||||||
cd ~/.local/myshellconfig
|
cd ~/.local/myshellconfig
|
||||||
git checkout master
|
git remote get-url ${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT} >/dev/null 2>&1
|
||||||
git remote set-url origin https://git.schuerz.at/jakob/myshellconfig.git
|
case $? in
|
||||||
git remote set-url origin --push git@git.schuerz.at:jakob/myshellconfig.git
|
2)
|
||||||
loginfo "new remote set to"
|
git remote add ${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT} ${MSC_GIT_PULLURL:-$MSC_GIT_PULLURL_DEFAULT}
|
||||||
git remote -v
|
git fetch ${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "no error getting remote url"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
git remote set-url ${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT} ${MSC_GIT_PULLURL:-$MSC_GIT_PULLURL_DEFAULT}
|
||||||
|
git remote set-url --push ${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT} ${MSC_GIT_PUSHURL:-$MSC_GIT_PUSHURL_DEFAULT}
|
||||||
|
git branch -u "${MSC_GIT_REMOTE_NAME:-$MSC_GIT_REMOTE_NAME_DEFAULT}"/"${MSC_GIT_BRANCH:-$MSC_GIT_BRANCH_DEFAULT}"
|
||||||
|
git checkout ${MSC_GIT_BRANCH:-$MSC_GIT_BRANCH_DEFAULT}
|
||||||
|
loginfo "now remotes are: $(git remote -v)"
|
||||||
|
loginfo "new upstream set to: $(git branch -vv)"
|
||||||
git fetch -p
|
git fetch -p
|
||||||
git merge FETCH_HEAD
|
git merge FETCH_HEAD
|
||||||
git submodule sync
|
git submodule sync
|
||||||
|
|
Loading…
Reference in a new issue