]>
Commit | Line | Data |
---|---|---|
5b61754d | 1 | #!/bin/bash -e |
f4f293be MF |
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 | ||
5b61754d MF |
5 | #if [[ $(git branch | awk '($1 == "*") {print $2}') != master ]] ; then |
6 | # echo "Switch to master first" | |
7 | # exit 1 | |
8 | #fi | |
9 | ||
f4f293be MF |
10 | g() { |
11 | set -- git "$@" | |
12 | echo "--- $*" | |
13 | "$@" | |
14 | } | |
15 | ||
5b61754d | 16 | if git config svn-remote.svn.url >/dev/null ; then |
c8d0286e MF |
17 | # git-config uses svn.authorsfile relative to repo root |
18 | # i.e. good to use .git/authors | |
5b61754d MF |
19 | set -- git svn fetch --all "$@" |
20 | expected="" | |
f45b2012 | 21 | elif git config remote.hg.url >/dev/null ; then |
f4f293be MF |
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 | |
5b61754d | 25 | elif git config cvs.cvsroot >/dev/null ; then |
c8d0286e | 26 | # authors file is at .git/cvs-authors |
2d20ee12 | 27 | set -- git cvsimport -a -d $(git config cvs.cvsroot) $(git config cvs.module) "$@" |
5b61754d | 28 | expected="Already up-to-date." |
19fbd939 MF |
29 | elif [[ -d CVS ]] && git rev-parse origin >/dev/null ; then |
30 | set -- git cvsimport -a | |
31 | expected="Already up-to-date." | |
5b61754d MF |
32 | else |
33 | set -- git pull "$@" | |
34 | expected="Already up-to-date." | |
35 | fi | |
36 | ||
37 | output=$( | |
38 | "$@" | tee /proc/$$/fd/1 | |
39 | _pipestatus=${PIPESTATUS[*]} | |
40 | [[ ${_pipestatus// /} -eq 0 ]] || exit 1 | |
41 | ) | |
42 | [[ ${output} == "${expected}" ]] && exit 0 | |
43 | ||
f4f293be MF |
44 | g fsck |
45 | g count-objects | |
46 | g gc --prune |