]> git.wh0rd.org - home.git/blame - .bin/git-update
import vapier-m
[home.git] / .bin / git-update
CommitLineData
5b61754d
MF
1#!/bin/bash -e
2#if [[ $(git branch | awk '($1 == "*") {print $2}') != master ]] ; then
3# echo "Switch to master first"
4# exit 1
5#fi
6
7if git config svn-remote.svn.url >/dev/null ; then
8 set -- git svn fetch --all "$@"
9 expected=""
10elif git config cvs.cvsroot >/dev/null ; then
11 set -- git cvsimport -d $(git config cvs.cvsroot) $(git config cvs.module) "$@"
12 expected="Already up-to-date."
13else
14 set -- git pull "$@"
15 expected="Already up-to-date."
16fi
17
18output=$(
19 "$@" | tee /proc/$$/fd/1
20 _pipestatus=${PIPESTATUS[*]}
21 [[ ${_pipestatus// /} -eq 0 ]] || exit 1
22)
23[[ ${output} == "${expected}" ]] && exit 0
24
25git fsck
26git count-objects
27git gc --prune