{"thread":{"id":"4937","subject":"[RFC/PATCH] Per branch properties for pull","startedAt":"2006-07-21T14:51:53Z","lastAt":"2006-07-24T12:58:52Z","messageCount":3,"participants":["Santi Béjar","Junio C Hamano","Santi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23977","messageId":"87hd1b9fjq.fsf@gmail.com","threadId":"4937","inReplyTo":null,"subject":"[RFC/PATCH] Per branch properties for pull","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2006-07-21T14:51:53Z","receivedAt":"2006-07-21T14:51:53Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"\nIt extracts all the information for pull from the config file.\n\nIf you have a config file as:\n\n[branch \"master\"]\n        remote=origin\n        merge=next          #the remote name\n        octopus=octopus\n        twohead=recursive\n\nWhen doing a \"git pull\" without extra parameters in the master branch\nit will fetch the origin remote repository and will merge the next\nbranch (the remote name).\n\nAnd you can also put the equivalent of the pull.{octopus,twohead}\noptions for each branch.\n\nThis only changes the behavour when these keys exist and when\ngit-pull is used without extra parameters.\n\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n\n---\n\nHi *,\n\n   Now that we have the arbitrary keys in the config file...\n\n   It does not affect the integrator that pulls from different\n   places. I don't know exactly what is needed but just for discuss it\n   could be something as:\n\n[branch \"master\"]\n        remote=net\n        remote=ata\n        merge=for-linus from ata\n        merge=upstream from net\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex f380437..e7630b1 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -44,6 +44,14 @@ do\n \tshift\n done\n \n+if [ $# -eq 0 ] ; then\n+    default=yes\n+    curr_branch=$(git-symbolic-ref HEAD)\n+    curr_branch=${curr_branch##refs/heads/}\n+    remote=$(git-repo-config --get \"branch.$curr_branch.remote\")\n+    test \"$remote\" && set x \"$remote\" && shift\n+fi\n+\n orig_head=$(git-rev-parse --verify HEAD) || die \"Pulling into a black hole?\"\n git-fetch --update-head-ok --reflog-action=pull \"$@\" || exit 1\n \n@@ -70,9 +78,19 @@ to recover.'\n \n fi\n \n+if [ \"$default\" == yes ] ; then\n+    merge_head=$(git repo-config --get-all \"branch.$curr_branch.merge\")\n+    for ref in $merge_head ; do\n+\trefspec=$(git-repo-config --get \"remote.$remote.fetch\" \"^$ref:\")\n+\t[ -z \"$refspec\" ] && die \"Branch $ref does not exist in the repository: $remote.\"\n+\tlocref=\"$locref ${refspec##$ref:}\"\n+    done\n+    merge_head=$locref\n+else\n merge_head=$(sed -e '/\tnot-for-merge\t/d' \\\n \t-e 's/\t.*//' \"$GIT_DIR\"/FETCH_HEAD | \\\n \ttr '\\012' ' ')\n+fi\n \n case \"$merge_head\" in\n '')\n@@ -85,6 +103,11 @@ case \"$merge_head\" in\n \tthen\n \t\tstrategy_default_args=\"-s $var\"\n \tfi\n+\tvar=`git-repo-config --get branch.$curr_branch.octopus`\n+\tif test -n \"$var\"\n+\tthen\n+\t\tstrategy_default_args=\"-s $var\"\n+\tfi\n \t;;\n *)\n \tvar=`git-repo-config --get pull.twohead`\n@@ -92,6 +115,11 @@ case \"$merge_head\" in\n         then\n \t\tstrategy_default_args=\"-s $var\"\n \tfi\n+\tvar=`git-repo-config --get branch.$curr_branch.twohead`\n+\tif test -n \"$var\"\n+        then\n+\t\tstrategy_default_args=\"-s $var\"\n+\tfi\n \t;;\n esac\n \n"},{"id":"24052","messageId":"7vmzaze9xj.fsf@assigned-by-dhcp.cox.net","threadId":"4937","inReplyTo":"87hd1b9fjq.fsf@gmail.com","subject":"Re: [RFC/PATCH] Per branch properties for pull","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-24T07:31:04Z","receivedAt":"2006-07-24T07:31:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n> It extracts all the information for pull from the config file.\n>\n> If you have a config file as:\n>\n> [branch \"master\"]\n>         remote=origin\n>         merge=next          #the remote name\n>         octopus=octopus\n>         twohead=recursive\n>\n> When doing a \"git pull\" without extra parameters in the master branch\n> it will fetch the origin remote repository and will merge the next\n> branch (the remote name).\n>\n> And you can also put the equivalent of the pull.{octopus,twohead}\n> options for each branch.\n>\n> This only changes the behavour when these keys exist and when\n> git-pull is used without extra parameters.\n>\n> Signed-off-by: Santi Béjar <sbejar@gmail.com>\n\nI am in general in agreement with this line of thought and had\nan impression that many on the list wanted to have per-branch\nconfiguration.  I am a bit too tired now so I'd just let you\nknow I am interested but would not apply it tonight.\n\nOpinions?  Comments?  Anything missing or objectionable on\nSanti's patch from the list?\n"},{"id":"24064","messageId":"8aa486160607240558n2b22c918v40cfcb26ed046472@mail.gmail.com","threadId":"4937","inReplyTo":"7vmzaze9xj.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC/PATCH] Per branch properties for pull","fromName":"Santi","fromEmail":"sbejar@gmail.com","sentAt":"2006-07-24T12:58:52Z","receivedAt":"2006-07-24T12:58:52Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2006/7/24, Junio C Hamano <junkio@cox.net>:\n> Santi Béjar <sbejar@gmail.com> writes:\n>\n> > It extracts all the information for pull from the config file.\n> >\n> > If you have a config file as:\n> >\n> > [branch \"master\"]\n> >         remote=origin\n> >         merge=next          #the remote name\n> >         octopus=octopus\n> >         twohead=recursive\n> >\n\n[...]\n\n> I am in general in agreement with this line of thought and had\n> an impression that many on the list wanted to have per-branch\n> configuration.  I am a bit too tired now so I'd just let you\n> know I am interested but would not apply it tonight.\n>\n> Opinions?  Comments?  Anything missing or objectionable on\n> Santi's patch from the list?\n\nActually my patch is a RFC to agree on the config semantics, (although\nI do not mind if committed to \"pu\" :) :\n\n.- are remote/merge good names?\n.- the merge key is the name of the remote branch.\n.- are the octopus and twohead OK?\n.- for a local merge, is remote=. OK?\n.- \"git pull .\" to mean: do not fetch anything but merge the default branch?\n.- for the integrator case:\n   * is the \"merge= rembranch from remote\" OK?\n   * \"git pull remotename\" should read the branch properties if\nbranch.$curr_branch.remote=remotename?\n   * It could be usefull to have a git-merge-seq that performs a\ntwohead merge sequentially instead of an octopus.\n\nThe patch as is works for me and it currently depends on the remote\nconfig being in .git/config.\n\nIt only touchs git-pull, just to have a working prototype of the\nsemantics and to minimize the breakage, but it could be that it should\nbe integrated in the git-parse-remote.\n\nSanti\n"}]}