]> git.wh0rd.org - home.git/blame_incremental - .bin/git-update
pinentry: switch to x11 as gtk-2 is dead
[home.git] / .bin / git-update
... / ...
CommitLineData
1#!/bin/bash -e
2# Helper script for various git mirrors of other VCS types.
3# I'm lazy and can't be bothered to remember the exact invocation.
4
5#if [[ $(git branch | awk '($1 == "*") {print $2}') != master ]] ; then
6# echo "Switch to master first"
7# exit 1
8#fi
9
10g() {
11 set -- git "$@"
12 echo "--- $*"
13 "$@"
14}
15
16if git config svn-remote.svn.url >/dev/null ; then
17 # git-config uses svn.authorsfile relative to repo root
18 # i.e. good to use .git/authors
19 set -- git svn fetch --all "$@"
20 expected=""
21elif git config remote.hg.url >/dev/null ; then
22 set -- git-hg pull
23 $(git config --get --bool remote.hg.force) && set -- "$@" --force
24 $(git config --get --bool remote.hg.rebase) && set -- "$@" --rebase
25elif git config cvs.cvsroot >/dev/null ; then
26 # authors file is at .git/cvs-authors
27 set -- git cvsimport -a -d $(git config cvs.cvsroot) $(git config cvs.module) "$@"
28 expected="Already up-to-date."
29elif [[ -d CVS ]] && git rev-parse origin >/dev/null ; then
30 set -- git cvsimport -a
31 expected="Already up-to-date."
32else
33 set -- git pull "$@"
34 expected="Already up-to-date."
35fi
36
37output=$(
38 "$@" | tee /proc/$$/fd/1
39 _pipestatus=${PIPESTATUS[*]}
40 [[ ${_pipestatus// /} -eq 0 ]] || exit 1
41)
42[[ ${output} == "${expected}" ]] && exit 0
43
44g fsck
45g count-objects
46g gc --prune