You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gitremotes 803B

1234567891011121314151617181920212223242526
  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.
  5. open (IN, "doc/git.mdwn") || die "doc/git.mdwn: $!";
  6. while (<IN>) {
  7. if (/^\*\s+\[?\[?(\w+)(?:\|\w+)?\]?\]?\s+`([^>]+)`/) {
  8. # note that the remote name has to be a simple word (\w)
  9. # for security/sanity reasons
  10. my $remote=$1;
  11. my $url=$2;
  12. # check configured url to deal with it changing
  13. my $info=`git remote show -n $remote`;
  14. my ($oldurl)=$info=~/URL: (.*)/m;
  15. if ($oldurl ne $url) {
  16. system("git remote rm $remote 2>/dev/null");
  17. system("git", "remote", "add", $remote, $url);
  18. system("git", "config", "remote.$remote.tagopt",
  19. "--no-tags");
  20. system("git", "fetch", $remote);
  21. }
  22. }
  23. }
  24. close IN;