Skip to contentSkip to conversation

git-fetch: Understand the branch property remote="."

PATCH New Santi Béjar 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-fetch: Understand the branch property remote="."

It extends the branch property "remote" to understand that "." is the local repository.

With this, 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.

---
 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