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>
This commit is contained in:
parent
1e61b7640d
commit
3894439022
@ -10,7 +10,7 @@ SYNOPSIS
|
|||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git-remote'
|
'git-remote'
|
||||||
'git-remote' add [-t <branch>] [-m <branch>] [-f] <name> <url>
|
'git-remote' add [-t <branch>] [-m <branch>] [-f] [--mirror] <name> <url>
|
||||||
'git-remote' show <name>
|
'git-remote' show <name>
|
||||||
'git-remote' prune <name>
|
'git-remote' prune <name>
|
||||||
'git-remote' update [group]
|
'git-remote' update [group]
|
||||||
@ -45,6 +45,10 @@ multiple branches without grabbing all branches.
|
|||||||
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
|
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
|
||||||
up to point at remote's `<master>` branch instead of whatever
|
up to point at remote's `<master>` branch instead of whatever
|
||||||
branch the `HEAD` at the remote repository actually points at.
|
branch the `HEAD` at the remote repository actually points at.
|
||||||
|
+
|
||||||
|
In mirror mode, enabled with `--mirror`, the refs will not be stored
|
||||||
|
in the 'refs/remotes/' namespace, but in 'refs/heads/'. This option
|
||||||
|
only makes sense in bare repositories.
|
||||||
|
|
||||||
'show'::
|
'show'::
|
||||||
|
|
||||||
|
@ -278,7 +278,9 @@ sub add_remote {
|
|||||||
|
|
||||||
for (@$track) {
|
for (@$track) {
|
||||||
$git->command('config', '--add', "remote.$name.fetch",
|
$git->command('config', '--add', "remote.$name.fetch",
|
||||||
"+refs/heads/$_:refs/remotes/$name/$_");
|
$opts->{'mirror'} ?
|
||||||
|
"+refs/$_:refs/$_" :
|
||||||
|
"+refs/heads/$_:refs/remotes/$name/$_");
|
||||||
}
|
}
|
||||||
if ($opts->{'fetch'}) {
|
if ($opts->{'fetch'}) {
|
||||||
$git->command('fetch', $name);
|
$git->command('fetch', $name);
|
||||||
@ -409,6 +411,10 @@ elsif ($ARGV[0] eq 'add') {
|
|||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if ($opt eq '--mirror') {
|
||||||
|
$opts{'mirror'} = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
add_usage();
|
add_usage();
|
||||||
}
|
}
|
||||||
if (@ARGV != 3) {
|
if (@ARGV != 3) {
|
||||||
|
Loading…
Reference in New Issue
Block a user