New commit in Git/spar/
[sunny256-utils.git] / sea-repo
blob63ff8312f1e476db427d3ef0334f13dfbc02b981
1 #!/usr/bin/env bash
3 #=======================================================================
4 # sea-repo
5 # File ID: 0ecaab8c-e677-11e4-8c39-000df06acc56
7 # Create repositories in /media/seagate-3tb/repos/Git-other/
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=sea-repo
15 # Set to "echo" to simulate things
16 simul=
18 for f in $*; do
19 f="$(echo -n $f | sed 's/\/$//')"
20 test -d $f/.git && (
21 cd $f && (
22 echo
23 echo ========== $f ==========
24 searepo=/media/seagate-3tb/repos/Git-other/$f.git
25 origin="$(git config --get remote.origin.url)"
26 test -d $searepo || $simul git init --bare $searepo || {
27 echo $progname: $searepo: cannot initialise repository >&2
28 exit 1
30 test -z "$(git config --get remote.seagate-3tb.url)" && $simul git remote add seagate-3tb $searepo
31 $simul git merge --ff-only
32 $simul git allbr -a
33 $simul git push --all seagate-3tb
34 $simul git push --tags seagate-3tb
35 test -z "$simul" && (
36 git remote -v >>$searepo/remotes.txt
37 sort -u $searepo/remotes.txt >$searepo/remotes.txt.tmp
38 mv $searepo/remotes.txt.tmp $searepo/remotes.txt
41 $simul cd $searepo && (
42 test -L /bellmann && (
43 test -z "$(git config --get remote.bellmann.url)" &&
44 test -d /bellmann/home/sunny/repos/Git-other/$f.git &&
45 $simul git remote add bellmann /bellmann/home/sunny/repos/Git-other/$f.git
47 test -z "$(git config --get remote.bellmann-src.url)" &&
48 test -d /bellmann/home/sunny/src/other/$f &&
49 $simul git remote add bellmann-src /bellmann/home/sunny/src/other/$f
51 test -z "$(git config --get remote.origin.url)" && test -n "$origin" && $simul git remote add origin $origin
52 true
56 ) || echo $progname: $f/.git: directory not found >&2
57 done