Skip to contentSkip to conversation

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

PATCH In review Santi Béjar 4 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-fetch: Allow branch."branchname".remote=.

---
 git-parse-remote.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
git-parse-remote.sh +9 -0
index 679f73c..617d022 100755
@@ -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." ;;
Signature · 1 line
1.4.3.rc2.ga442
author
#2 lore raw

2006/10/13, Junio C Hamano <[email protected]>:

Quoted 5 lines

Santi Béjar <[email protected]> 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

#3 lore raw

Hi,

Quoted 8 lines · Santi

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

#4 lore raw
Quoted 3 lines · Johannes Schindelin

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.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#5 lore raw

Hi,

Quoted 11 lines · Jakub Narebski
Quoted 3 lines · Johannes Schindelin

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

#6 lore raw

<opublikowany i wysłany>

Quoted 18 lines · Johannes Schindelin
Quoted 9 lines · Jakub Narebski
Quoted 3 lines · Johannes Schindelin

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>...
Quoted 6 lines

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.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git