add github timo repo
[ikiwiki.git] / gitremotes
blob5cafad1b8dcb550c694567b7815978a7861fc6fe
1 #!/usr/bin/perl
2 # Parses list of remotes in doc/git.mdwn, configures git to use them
3 # all. After running this, use "git remote update --prune" to pull
4 # updates from all remotes.
6 open (IN, "doc/git.mdwn") || die "doc/git.mdwn: $!";
7 while (<IN>) {
8 if (/^\*\s+\[?\[?(\w+)(?:\|\w+)?\]?\]?\s+`([^>]+)`/) {
9 # note that the remote name has to be a simple word (\w)
10 # for security/sanity reasons
11 my $remote=$1;
12 my $url=$2;
14 # check configured url to deal with it changing
15 my $info=`git remote show -n $remote`;
16 my ($oldurl)=$info=~/URL: (.*)/m;
17 if ($oldurl ne $url) {
18 system("git remote rm $remote 2>/dev/null");
19 system("git", "remote", "add", $remote, $url);
20 system("git", "config", "remote.$remote.tagopt",
21 "--no-tags");
22 system("git", "fetch", $remote);
26 close IN;