A list of stuff that would be nice to work on for enhancing the GNU Hurd web pages.
[ikiwiki.git] / gitremotes
blobe2468814b01155f99ae7d7716851eb523e3e6220
1 #!/usr/bin/perl
2 # Parses list of remotes in doc/git.mdwn, configures git to use them
3 # all, and fetches updates from them.
5 my $error=0;
7 open (IN, "doc/git.mdwn") || die "doc/git.mdwn: $!";
8 while (<IN>) {
9 if (/^\*\s+\[?\[?(\w+)(?:\|\w+)?\]?\]?\s+`([^>]+)`/) {
10 # note that the remote name has to be a simple word (\w)
11 # for security/sanity reasons
12 my $remote=$1;
13 my $url=$2;
15 # check configured url to deal with it changing
16 my $info=`git remote show -n $remote`;
17 my ($oldurl)=$info=~/URL: (.*)/m;
18 my $r;
19 if ($oldurl ne $url) {
20 system("git remote rm $remote 2>/dev/null");
21 $r = system("git", "remote", "add", "-f", $remote, $url)
23 else {
24 $r = system("git", "fetch", "--no-tag", $remote);
27 if ($r != 0) {
28 print "$remote failed\n";
30 $error |= $r;
33 close IN;
35 exit $error;