git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-fetch: Allow branch."branchname".remote=.
@ 2006-10-13  7:50 Santi Béjar
  2006-10-13  7:56 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Santi Béjar @ 2006-10-13  7:50 UTC (permalink / raw)
  To: Git Mailing List


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13  7:50 [PATCH] git-fetch: Allow branch."branchname".remote= Santi Béjar
@ 2006-10-13  7:56 ` Junio C Hamano
  2006-10-13  9:08   ` Santi
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2006-10-13  7:56 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

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

<nothing>

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

What does it do?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13  7:56 ` Junio C Hamano
@ 2006-10-13  9:08   ` Santi
  2006-10-13 11:27     ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Santi @ 2006-10-13  9:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13  9:08   ` Santi
@ 2006-10-13 11:27     ` Johannes Schindelin
  2006-10-13 12:39       ` Jakub Narebski
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2006-10-13 11:27 UTC (permalink / raw)
  To: Santi; +Cc: Junio C Hamano, git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13 11:27     ` Johannes Schindelin
@ 2006-10-13 12:39       ` Jakub Narebski
  2006-10-13 12:53         ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Narebski @ 2006-10-13 12:39 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13 12:39       ` Jakub Narebski
@ 2006-10-13 12:53         ` Johannes Schindelin
  2006-10-13 13:06           ` Jakub Narebski
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2006-10-13 12:53 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Santi Béjar, git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-fetch: Allow branch."branchname".remote=.
  2006-10-13 12:53         ` Johannes Schindelin
@ 2006-10-13 13:06           ` Jakub Narebski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Narebski @ 2006-10-13 13:06 UTC (permalink / raw)
  To: git

<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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-13 13:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-13  7:50 [PATCH] git-fetch: Allow branch."branchname".remote= Santi Béjar
2006-10-13  7:56 ` Junio C Hamano
2006-10-13  9:08   ` Santi
2006-10-13 11:27     ` Johannes Schindelin
2006-10-13 12:39       ` Jakub Narebski
2006-10-13 12:53         ` Johannes Schindelin
2006-10-13 13:06           ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).