- $git->command('config', "remote.$name.fetch",
- "+refs/heads/*:refs/remotes/$name/*");
+ my $track = $opts->{'track'} || ["*"];
+
+ for (@$track) {
+ $git->command('config', '--add', "remote.$name.fetch",
+ "+refs/heads/$_:refs/remotes/$name/$_");
+ }
+ if ($opts->{'fetch'}) {
+ $git->command('fetch', $name);
+ }
+ if (exists $opts->{'master'}) {
+ $git->command('symbolic-ref', "refs/remotes/$name/HEAD",
+ "refs/remotes/$name/$opts->{'master'}");
+ }
+}
+
+sub add_usage {
+ print STDERR "Usage: git remote add [-f] [-t track]* [-m master] <name> <url>\n";
+ exit(1);