Skip to content

Commit

Permalink
Merge branch 'js/remote'
Browse files Browse the repository at this point in the history
* js/remote:
  Teach "git remote" a mirror mode
  • Loading branch information
Junio C Hamano committed Sep 15, 2007
2 parents 07efafe + 3894439 commit d3392f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Documentation/git-remote.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'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' prune <name>
'git-remote' update [group]
Expand Down Expand Up @@ -45,6 +45,10 @@ multiple branches without grabbing all branches.
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
up to point at remote's `<master>` branch instead of whatever
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'::

Expand Down
8 changes: 7 additions & 1 deletion git-remote.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -409,6 +411,10 @@ sub add_usage {
shift @ARGV;
next;
}
if ($opt eq '--mirror') {
$opts{'mirror'} = 1;
next;
}
add_usage();
}
if (@ARGV != 3) {
Expand Down

0 comments on commit d3392f7

Please sign in to comment.