threads / patch / 5913

patchgit-fetch: Allow branch."branchname".remote=.

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

## tl;dr

7 messages between Oct 13, 2006 and Oct 13, 2006. Diffs are folded; open one to read it.

replies: 6people: 4as markdown or json

Santi Béjar· Oct 13, 2006, 07:50 UTC · lore
Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 git-parse-remote.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Show changes to git-parse-remote.sh +9 −0
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
Santi· Oct 13, 2006, 09:08 UTC · re: Junio C Hamano · lore

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

2006/10/13, Junio C Hamano <junkio@cox.net>:
Show 5 quoted lines
> 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· Oct 13, 2006, 11:27 UTC · re: Santi · lore

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

Hi,
On Fri, 13 Oct 2006, Santi wrote:
Show 8 quoted lines
> 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· Oct 13, 2006, 12:39 UTC · re: Johannes Schindelin · lore

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

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· Oct 13, 2006, 12:53 UTC · re: Jakub Narebski · lore

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

Hi,
On Fri, 13 Oct 2006, Jakub Narebski wrote:
Show 9 quoted lines
> 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· Oct 13, 2006, 13:06 UTC · re: Johannes Schindelin · lore

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

<opublikowany i wysłany>
Johannes Schindelin wrote:
Show 24 quoted lines
> 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

← back to recent threads