From f4f293be28643ab5eb2cc73ec1766bcad4f4939f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 26 Oct 2015 17:16:18 -0400 Subject: [PATCH] git-update: improve git-hg handling and general output --- .bin/git-update | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.bin/git-update b/.bin/git-update index 324dc7b..09e77af 100755 --- a/.bin/git-update +++ b/.bin/git-update @@ -1,16 +1,27 @@ #!/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 - git-hg pull + 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 # authors file is at .git/cvs-authors set -- git cvsimport -a -d $(git config cvs.cvsroot) $(git config cvs.module) "$@" @@ -30,6 +41,6 @@ output=$( ) [[ ${output} == "${expected}" ]] && exit 0 -git fsck -git count-objects -git gc --prune +g fsck +g count-objects +g gc --prune -- 2.39.5