X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fgit-update;h=09e77aff31bb5f95fa51a485a20a331b5621321b;hb=HEAD;hp=1c4b742bd146b7d915f7c43f7eb66457d6c04385;hpb=5b61754dc15ad3f7c19e83aecc4a921e6f8fa5df;p=home.git diff --git a/.bin/git-update b/.bin/git-update index 1c4b742..09e77af 100755 --- a/.bin/git-update +++ b/.bin/git-update @@ -1,14 +1,33 @@ #!/bin/bash -e +# Helper script for various git mirrors of other VCS types. +# I'm lazy and can't be bothered to remember the exact invocation. + #if [[ $(git branch | awk '($1 == "*") {print $2}') != master ]] ; then # echo "Switch to master first" # exit 1 #fi +g() { + set -- git "$@" + echo "--- $*" + "$@" +} + if git config svn-remote.svn.url >/dev/null ; then + # git-config uses svn.authorsfile relative to repo root + # i.e. good to use .git/authors set -- git svn fetch --all "$@" expected="" +elif git config remote.hg.url >/dev/null ; then + set -- git-hg pull + $(git config --get --bool remote.hg.force) && set -- "$@" --force + $(git config --get --bool remote.hg.rebase) && set -- "$@" --rebase elif git config cvs.cvsroot >/dev/null ; then - set -- git cvsimport -d $(git config cvs.cvsroot) $(git config cvs.module) "$@" + # authors file is at .git/cvs-authors + set -- git cvsimport -a -d $(git config cvs.cvsroot) $(git config cvs.module) "$@" + expected="Already up-to-date." +elif [[ -d CVS ]] && git rev-parse origin >/dev/null ; then + set -- git cvsimport -a expected="Already up-to-date." else set -- git pull "$@" @@ -22,6 +41,6 @@ output=$( ) [[ ${output} == "${expected}" ]] && exit 0 -git fsck -git count-objects -git gc --prune +g fsck +g count-objects +g gc --prune