* [RFC/PATCH] Per branch properties for pull
@ 2006-07-21 14:51 Santi Béjar
2006-07-24 7:31 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Santi Béjar @ 2006-07-21 14:51 UTC (permalink / raw)
To: Git Mailing List
It extracts all the information for pull from the config file.
If you have a config file as:
[branch "master"]
remote=origin
merge=next #the remote name
octopus=octopus
twohead=recursive
When doing a "git pull" without extra parameters in the master branch
it will fetch the origin remote repository and will merge the next
branch (the remote name).
And you can also put the equivalent of the pull.{octopus,twohead}
options for each branch.
This only changes the behavour when these keys exist and when
git-pull is used without extra parameters.
Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
Hi *,
Now that we have the arbitrary keys in the config file...
It does not affect the integrator that pulls from different
places. I don't know exactly what is needed but just for discuss it
could be something as:
[branch "master"]
remote=net
remote=ata
merge=for-linus from ata
merge=upstream from net
diff --git a/git-pull.sh b/git-pull.sh
index f380437..e7630b1 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -44,6 +44,14 @@ do
shift
done
+if [ $# -eq 0 ] ; then
+ default=yes
+ curr_branch=$(git-symbolic-ref HEAD)
+ curr_branch=${curr_branch##refs/heads/}
+ remote=$(git-repo-config --get "branch.$curr_branch.remote")
+ test "$remote" && set x "$remote" && shift
+fi
+
orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?"
git-fetch --update-head-ok --reflog-action=pull "$@" || exit 1
@@ -70,9 +78,19 @@ to recover.'
fi
+if [ "$default" == yes ] ; then
+ merge_head=$(git repo-config --get-all "branch.$curr_branch.merge")
+ for ref in $merge_head ; do
+ refspec=$(git-repo-config --get "remote.$remote.fetch" "^$ref:")
+ [ -z "$refspec" ] && die "Branch $ref does not exist in the repository: $remote."
+ locref="$locref ${refspec##$ref:}"
+ done
+ merge_head=$locref
+else
merge_head=$(sed -e '/ not-for-merge /d' \
-e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | \
tr '\012' ' ')
+fi
case "$merge_head" in
'')
@@ -85,6 +103,11 @@ case "$merge_head" in
then
strategy_default_args="-s $var"
fi
+ var=`git-repo-config --get branch.$curr_branch.octopus`
+ if test -n "$var"
+ then
+ strategy_default_args="-s $var"
+ fi
;;
*)
var=`git-repo-config --get pull.twohead`
@@ -92,6 +115,11 @@ case "$merge_head" in
then
strategy_default_args="-s $var"
fi
+ var=`git-repo-config --get branch.$curr_branch.twohead`
+ if test -n "$var"
+ then
+ strategy_default_args="-s $var"
+ fi
;;
esac
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] Per branch properties for pull
2006-07-21 14:51 [RFC/PATCH] Per branch properties for pull Santi Béjar
@ 2006-07-24 7:31 ` Junio C Hamano
2006-07-24 12:58 ` Santi
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-07-24 7:31 UTC (permalink / raw)
To: Santi Béjar; +Cc: git
Santi Béjar <sbejar@gmail.com> writes:
> It extracts all the information for pull from the config file.
>
> If you have a config file as:
>
> [branch "master"]
> remote=origin
> merge=next #the remote name
> octopus=octopus
> twohead=recursive
>
> When doing a "git pull" without extra parameters in the master branch
> it will fetch the origin remote repository and will merge the next
> branch (the remote name).
>
> And you can also put the equivalent of the pull.{octopus,twohead}
> options for each branch.
>
> This only changes the behavour when these keys exist and when
> git-pull is used without extra parameters.
>
> Signed-off-by: Santi Béjar <sbejar@gmail.com>
I am in general in agreement with this line of thought and had
an impression that many on the list wanted to have per-branch
configuration. I am a bit too tired now so I'd just let you
know I am interested but would not apply it tonight.
Opinions? Comments? Anything missing or objectionable on
Santi's patch from the list?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] Per branch properties for pull
2006-07-24 7:31 ` Junio C Hamano
@ 2006-07-24 12:58 ` Santi
0 siblings, 0 replies; 3+ messages in thread
From: Santi @ 2006-07-24 12:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
2006/7/24, Junio C Hamano <junkio@cox.net>:
> Santi Béjar <sbejar@gmail.com> writes:
>
> > It extracts all the information for pull from the config file.
> >
> > If you have a config file as:
> >
> > [branch "master"]
> > remote=origin
> > merge=next #the remote name
> > octopus=octopus
> > twohead=recursive
> >
[...]
> I am in general in agreement with this line of thought and had
> an impression that many on the list wanted to have per-branch
> configuration. I am a bit too tired now so I'd just let you
> know I am interested but would not apply it tonight.
>
> Opinions? Comments? Anything missing or objectionable on
> Santi's patch from the list?
Actually my patch is a RFC to agree on the config semantics, (although
I do not mind if committed to "pu" :) :
.- are remote/merge good names?
.- the merge key is the name of the remote branch.
.- are the octopus and twohead OK?
.- for a local merge, is remote=. OK?
.- "git pull ." to mean: do not fetch anything but merge the default branch?
.- for the integrator case:
* is the "merge= rembranch from remote" OK?
* "git pull remotename" should read the branch properties if
branch.$curr_branch.remote=remotename?
* It could be usefull to have a git-merge-seq that performs a
twohead merge sequentially instead of an octopus.
The patch as is works for me and it currently depends on the remote
config being in .git/config.
It only touchs git-pull, just to have a working prototype of the
semantics and to minimize the breakage, but it could be that it should
be integrated in the git-parse-remote.
Santi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-07-24 12:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-21 14:51 [RFC/PATCH] Per branch properties for pull Santi Béjar
2006-07-24 7:31 ` Junio C Hamano
2006-07-24 12:58 ` Santi
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).