Backup the array passed to fetch_pack so we can free items
[gitweb.git] / git-remote.perl
index 01cf480221be1e5860bd701d5d17ced25766d38d..f6f283ea4f8b45671b7d9b34687d5d7b8475e8b3 100755 (executable)
@@ -278,7 +278,9 @@ sub add_remote {
 
        for (@$track) {
                $git->command('config', '--add', "remote.$name.fetch",
-                             "+refs/heads/$_:refs/remotes/$name/$_");
+                               $opts->{'mirror'} ?
+                               "+refs/$_:refs/$_" :
+                               "+refs/heads/$_:refs/remotes/$name/$_");
        }
        if ($opts->{'fetch'}) {
                $git->command('fetch', $name);
@@ -409,6 +411,10 @@ sub add_usage {
                        shift @ARGV;
                        next;
                }
+               if ($opt eq '--mirror') {
+                       $opts{'mirror'} = 1;
+                       next;
+               }
                add_usage();
        }
        if (@ARGV != 3) {