summaryrefslogtreecommitdiff
path: root/git-remote.perl
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-09-02 21:10:14 +0100
committerJunio C Hamano <gitster@pobox.com>2007-09-03 03:08:12 -0700
commit38944390220425cc3c4208dd31172397e7f18e8c (patch)
treef5be223d898f8ca293e31393e92684f2a3a128bd /git-remote.perl
parent1e61b7640d09015213dbcae3564fa27ac6a8c151 (diff)
downloadgit-38944390220425cc3c4208dd31172397e7f18e8c.tar.gz
Teach "git remote" a mirror mode
When using the "--mirror" option to "git remote add", the refs will not be stored in the refs/remotes/ namespace, but in the same location as on the remote side. This option probably only makes sense in a bare repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-remote.perl')
-rwxr-xr-xgit-remote.perl8
1 files changed, 7 insertions, 1 deletions
diff --git a/git-remote.perl b/git-remote.perl
index 01cf480221..f6f283ea4f 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -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 @@ elsif ($ARGV[0] eq 'add') {
shift @ARGV;
next;
}
+ if ($opt eq '--mirror') {
+ $opts{'mirror'} = 1;
+ next;
+ }
add_usage();
}
if (@ARGV != 3) {