git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH, 4th version] git-branch: register where to merge from, when branching off a remote branch

From
Paolo Bonzini <paolo.bonzini@gmail.com>
Date
Mar 2, 2007, 11:14 UTC
Message-ID
<45E8072A.2020303@lu.unisi.ch>
In-Reply-To
<7vtzx4ezvm.fsf@assigned-by-dhcp.cox.net>
Show 8 quoted lines
> I have a feeling that "git checkout -b" and "git checkout -B"
> should be taught to explicitly use "git branch --no-track" and
> "git branch --track" to create a new branch (currently it does
> not even use "git branch" as far as I can tell).  With your
> patch, I suspect that you have to say "git branch topic
> origin/topic" and then "git checkout topic", which means you
> made the three-step process into two steps, but you could have
> made it into one step.
Well, yes, the next part would have been to patch git-checkout.  But this one is already proving to be complicated enough.  :-)
> I'll send out an untested patch to
> git-checkout so that you can try it out in a separate message.
I saw it.  I tested your patch and it seems to work.
 
>  - (micronit) Is it true that both strlen() tests are about long
>    *branch* names?
If you consider something like "origin/next" to be a branch name, yes.
Show 8 quoted lines
>  - (moderately serious) The code blindly trusts that
>    "refs/remotes/foo/bar" tracks "refs/heads/bar" from remote
>    named "foo", which is a bit disturbing.  With the default
>    configuration git-clone and git-remote creates, it always is
>    the case, but I suspect you might want to at least verify
>    that assumption (the user can have different settings in the
>    config), if not figuring them out by reading the existing
>    configuration yourself.
Ouch.  Absolutely right, but this means I will prepare the patch later then.
>> +	else if (dwim_ref(start_name, strlen(start_name), sha1, &real_ref))
>> +		remote = !prefixcmp(real_ref, "refs/remotes/");
> 
>  - (pure question) What happens if dwim_ref() returns more than one?
Then, real_ref is the one matching sha1.
Considering your other objection about the naming of the variable, what about enabling/disabling the tracking using remote.REMOTENAME.tracklocalsubbranches?
Paolo
Previous: Jeff KingNext: Johannes Schindelin
Message 42 of 48 in “defaults for where to merge from”
  1. Paolo BonziniFeb 28, 2007
  2. Johannes SchindelinFeb 28, 2007
  3. Andy ParkinsFeb 28, 2007
  4. Paolo BonziniFeb 28, 2007
  5. Andy ParkinsFeb 28, 2007
  6. Julian PhillipsFeb 28, 2007
  7. Johannes SchindelinFeb 28, 2007
  8. Paolo BonziniFeb 28, 2007
  9. Johannes SchindelinFeb 28, 2007
  10. defaults for where to merge from (take 2)Paolo Bonzini, Mar 1, 2007
  11. Alex RiesenFeb 28, 2007
  12. Paolo BonziniFeb 28, 2007
  13. Alex RiesenMar 1, 2007
  14. Johannes SchindelinMar 1, 2007
  15. Alex RiesenMar 1, 2007
  16. Paolo BonziniMar 1, 2007
  17. Alex RiesenMar 1, 2007
  18. Junio C HamanoMar 1, 2007
  19. J. Bruce FieldsMar 2, 2007
  20. Paolo BonziniMar 1, 2007
  21. Alex RiesenMar 1, 2007
  22. Paolo BonziniMar 1, 2007
  23. Alex RiesenMar 1, 2007
  24. defaults for where to merge from (take 3)Paolo Bonzini, Mar 1, 2007
  25. Alex RiesenMar 1, 2007
  26. Paolo BonziniMar 1, 2007
  27. Junio C HamanoMar 1, 2007
  28. Alex RiesenMar 1, 2007
  29. Junio C HamanoMar 2, 2007
  30. Alex RiesenMar 2, 2007
  31. Junio C HamanoMar 2, 2007
  32. Alex RiesenMar 1, 2007
  33. Paolo BonziniMar 1, 2007
  34. Johannes SchindelinMar 1, 2007
  35. Paolo BonziniMar 2, 2007
  36. git-branch: register where to merge from, when branching off a remote branchPaolo Bonzini, Mar 2, 2007
  37. Junio C HamanoMar 2, 2007
  38. Junio C HamanoMar 2, 2007
  39. Jeff KingMar 2, 2007
  40. Paolo BonziniMar 2, 2007
  41. Jeff KingMar 2, 2007
  42. Paolo BonziniMar 2, 2007
  43. Johannes SchindelinMar 2, 2007
  44. Paolo BonziniMar 2, 2007
  45. Johannes SchindelinMar 2, 2007
  46. Johannes SchindelinMar 2, 2007
  47. Jakub NarebskiMar 2, 2007
  48. Peter BaumannFeb 28, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.