# [PATCH] git-fetch: Allow branch."branchname".remote=.

7 messages from 2006-10-13 to 2006-10-13. Participants: Santi Béjar, Junio C Hamano, Santi, Johannes Schindelin, Jakub Narebski.
Thread: https://gitlist.dev/t/5913

## Santi Béjar, 2006-10-13 07:50

Subject: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <87y7rk3b9n.fsf@gmail.com>
URL: https://gitlist.dev/e/87y7rk3b9n.fsf%40gmail.com

```

Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 git-parse-remote.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 679f73c..617d022 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -187,6 +187,15 @@ get_remote_refs_for_push () {
 }
 
 get_remote_refs_for_fetch () {
+	if [ "$#,$1" = "1,." ] ;
+	then
+	    curr_branch=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
+	    branch_remote=$(git-repo-config --get "branch.$curr_branch.remote")
+	    if [ "$branch_remote" = "." ]
+	    then
+		set . $(git-repo-config --get-all "branch.${curr_branch}.merge")
+	    fi
+	fi
 	case "$#" in
 	0)
 	    die "internal error: get-remote-refs-for-fetch." ;;
-- 
1.4.3.rc2.ga442

```

## Junio C Hamano, 2006-10-13 07:56

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <7vpscwd4ya.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vpscwd4ya.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <87y7rk3b9n.fsf@gmail.com>

```
Santi Béjar <sbejar@gmail.com> writes:

<nothing>

> Signed-off-by: Santi Béjar <sbejar@gmail.com>

What does it do?

```

## Santi, 2006-10-13 09:08

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <8aa486160610130208s67ea0746o8a54910860b3fb78@mail.gmail.com>
URL: https://gitlist.dev/e/8aa486160610130208s67ea0746o8a54910860b3fb78%40mail.gmail.com
In-Reply-To: <7vpscwd4ya.fsf@assigned-by-dhcp.cox.net>

```
2006/10/13, Junio C Hamano <junkio@cox.net>:
> Santi Béjar <sbejar@gmail.com> writes:
>
>
> What does it do?
>

It allows to define that the default remote repository is the local
one. For example, in git.git you could have:

[branch "next"]
   remote="."
   merge=master

so the default merge in the next branch is the master branch in the
local repository.

Santi

```

## Johannes Schindelin, 2006-10-13 11:27

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <Pine.LNX.4.63.0610131324090.14200@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0610131324090.14200%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <8aa486160610130208s67ea0746o8a54910860b3fb78@mail.gmail.com>

```
Hi,

On Fri, 13 Oct 2006, Santi wrote:

> For example, in git.git you could have:
> 
> [branch "next"]
>   remote="."
>   merge=master
> 
> so the default merge in the next branch is the master branch in the
> local repository.

There is a subtle problem here. Up until now, "remote" meant a short cut. 
You either had a file with that name in .git/remotes/ or .git/branches, or 
an entry in the config (remote.<name>.url).

You use it differently here, designating the URL instead of the remote. 
I'd rather have it point to a real remote.

Ciao,
Dscho

```

## Jakub Narebski, 2006-10-13 12:39

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <ego1ea$tsn$1@sea.gmane.org>
URL: https://gitlist.dev/e/ego1ea%24tsn%241%40sea.gmane.org
In-Reply-To: <Pine.LNX.4.63.0610131324090.14200@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin wrote:

> There is a subtle problem here. Up until now, "remote" meant a short cut. 
> You either had a file with that name in .git/remotes/ or .git/branches, or 
> an entry in the config (remote.<name>.url).

Not exactly. "git-pull . <branch>" and "git-peek-remote ." meant use
_current_ repository. "." as remote name means "current", i.e. local 
repository.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Johannes Schindelin, 2006-10-13 12:53

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <Pine.LNX.4.63.0610131448390.14200@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0610131448390.14200%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <ego1ea$tsn$1@sea.gmane.org>

```
Hi,

On Fri, 13 Oct 2006, Jakub Narebski wrote:

> Johannes Schindelin wrote:
> 
> > There is a subtle problem here. Up until now, "remote" meant a short cut. 
> > You either had a file with that name in .git/remotes/ or .git/branches, or 
> > an entry in the config (remote.<name>.url).
> 
> Not exactly. "git-pull . <branch>" and "git-peek-remote ." meant use
> _current_ repository. "." as remote name means "current", i.e. local 
> repository.

>From Documentation/git-pull.txt:

	SYNOPSIS
	--------
	'git-pull' <options> <repository> <refspec>...

It says "repository", not "remote". As for the name "git-peek-remote": 
yes, it is a short cut for "remote repository".

The thing is, if you say you pull "from a remote", then it is not 
sufficient to specify just a URL of a repository. You also have to specify 
a branch.

For git-peek-remote and git-ls-remote, you only need a URL.

If you mix the usage, people get as confused as with the terms "pull", 
"update" and "merge".

Ciao,
Dscho

```

## Jakub Narebski, 2006-10-13 13:06

Subject: Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
Message-ID: <ego2vm$568$1@sea.gmane.org>
URL: https://gitlist.dev/e/ego2vm%24568%241%40sea.gmane.org
In-Reply-To: <Pine.LNX.4.63.0610131448390.14200@wbgn013.biozentrum.uni-wuerzburg.de>

```
<opublikowany i wysłany>

Johannes Schindelin wrote:


> On Fri, 13 Oct 2006, Jakub Narebski wrote:
> 
>> Johannes Schindelin wrote:
>> 
>> > There is a subtle problem here. Up until now, "remote" meant a short cut. 
>> > You either had a file with that name in .git/remotes/ or .git/branches, or 
>> > an entry in the config (remote.<name>.url).
>> 
>> Not exactly. "git-pull . <branch>" and "git-peek-remote ." meant use
>> _current_ repository. "." as remote name means "current", i.e. local 
>> repository.
> 
> From Documentation/git-pull.txt:
> 
>       SYNOPSIS
>       --------
>       'git-pull' <options> <repository> <refspec>...
> 
> It says "repository", not "remote". As for the name "git-peek-remote": 
> yes, it is a short cut for "remote repository".
> 
> The thing is, if you say you pull "from a remote", then it is not 
> sufficient to specify just a URL of a repository. You also have to specify 
> a branch.

O.K. "remote" = "repository + set of branches". But we can say that "."
is a default remote, which points to local repository (".") and has
no branches information.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```
