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

Re: PUSH_HEAD, was Re: disallowing push to currently checked-out branch

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 17, 2009, 17:29 UTC
Message-ID
<76718490902170929v3ed9e3c2tb2f7fb1bfc01b3ab@mail.gmail.com>
In-Reply-To
<alpine.DEB.1.00.0902171200250.6185@intel-tinevez-2-302>

On Tue, Feb 17, 2009 at 6:28 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 8 quoted lines
>> receive.localBranches = (refuse | allow)
>>
>> http://thread.gmane.org/gmane.comp.version-control.git/77955/focus=78065
>
> In the meantime, we have receive.denyCurrentBranch, which is much superior
> to the localBranches design: it tackles the _real_ issue -- the only
> reason why a current branch cannot be updated lightly is that it might
> have a working directory which would be forced out-of-sync.
Hmpfh.

So both you and Junio have changed your mind since that thread then. Because in that thread, you propose receive.guardCurrentBranch, which was quite similar to today's receive.denyCurrentBranch. Junio then argues that treating just the checked-out branch as special, as opposed to all local branches is not the right thing to do:

--- snip --- http://thread.gmane.org/gmane.comp.version-control.git/77955/focus=78062

Step back a bit and think _why_ you wanted to prevent current branch tip from getting updated in the first place. There are two issues:

 * Why is it _current_ branch, and not _these branches_, that can be
   configured by the user to be protected from a push from sideways?
 * Why is it undesirable for the work tree and the index to go out of sync
   with respect to the branch tip to begin with?

The latter is simpler to answer, so let's deal with it first. The reason why it is bad is because allowing a push to the current branch interferes with the work actively being done in the repository, using the work tree contents. There is a person, you, who is actively editing the work tree in order to advance the tip of the branch by making commits. If the branch tip moves without your knowing, that destabilizes your working environment. Your work tree wanted to make a new commit on top of some known state, but that state was moved underneath you. Not good.

When you are using the repository for real work (i.e. advance the tips of its branches), you want a stable environment. You do not want its HEAD bobbing around outside your control, and silently detaching to cause your later commits to go to unnamed branch without your knowing is just as bad (which you already correctly objected to). --- snip ---

And you end up agreeing:

--- snip --- http://thread.gmane.org/gmane.comp.version-control.git/77955/focus=78062

Show 8 quoted lines
> Now think.  What if one of these operations you do in the repository to
> advance the tip was to merge from one of _your_ local branches?  Yes,
> you end up merging something you did not expect to merge if you allowed
> a push from sideways to affect that local branch, only because the
> branch happened to be un-checked-out and you implemented this protection
> to forbid only to current branch.  Allowing a push from sideways to any
> local branch destabilizes your work environment, not just the current
> one.
Okay, I am starting to see the light.
How about
	receive.localBranches = (refuse | allow)
--- snip ---

Then the thread died, with receive.localBranches going into TODO, but never got an implementation. Sometime later, receive.denyCurrentBranch came along, which is the original idea you proposed, Junio argued against, and then you agreed.

So, I'm not sure what happened in the intervening time between the receive.localBranches proposal and the receive.denyCurrentBranch implementation that suddenly what is basically guardCurrentBranch became a good idea.

But, I happen to agree with Junio's argument in gmane 77955.
j.
Previous: Johannes SchindelinNext: Jeff King
Message 26 of 91 in “[RFC - draft] List of proposed future changes that are backward incompatible”
  1. Junio C HamanoFeb 15, 2009
  2. Junio C HamanoFeb 15, 2009
  3. Jakub NarebskiFeb 15, 2009
  4. Junio C HamanoFeb 15, 2009
  5. Heikki OrsilaFeb 15, 2009
  6. disallowing push to currently checked-out branchJeff King, Feb 16, 2009
  7. david@lang.hmFeb 16, 2009
  8. david@lang.hmFeb 16, 2009
  9. Julian PhillipsFeb 16, 2009
  10. Jeff KingFeb 16, 2009
  11. Daniel BarkalowFeb 16, 2009
  12. Junio C HamanoFeb 16, 2009
  13. Sergio CallegariFeb 16, 2009
  14. Jeff KingFeb 16, 2009
  15. Sergio CallegariFeb 16, 2009
  16. Matthieu MoyFeb 16, 2009
  17. Johannes SchindelinFeb 16, 2009
  18. Jay SoffianFeb 16, 2009
  19. Johannes SchindelinFeb 16, 2009
  20. Jay SoffianFeb 16, 2009
  21. Johannes SchindelinFeb 16, 2009
  22. Jay SoffianFeb 16, 2009
  23. Jeff KingFeb 16, 2009
  24. Jay SoffianFeb 17, 2009
  25. PUSH_HEAD, was Re: disallowing push to currently checked-out branchJohannes Schindelin, Feb 17, 2009
  26. Jay SoffianFeb 17, 2009
  27. Jeff KingFeb 17, 2009
  28. Junio C HamanoFeb 17, 2009
  29. Jay SoffianFeb 17, 2009
  30. Johannes SchindelinFeb 17, 2009
  31. Sergio CallegariFeb 16, 2009
  32. Johannes SchindelinFeb 16, 2009
  33. Jay SoffianFeb 16, 2009
  34. Sergio CallegariFeb 17, 2009
  35. Johannes SchindelinFeb 17, 2009
  36. Sergio CallegariFeb 17, 2009
  37. Johannes SchindelinFeb 17, 2009
  38. Junio C HamanoFeb 17, 2009
  39. Junio C HamanoFeb 17, 2009
  40. Junio C HamanoFeb 16, 2009
  41. Jeff KingFeb 16, 2009
  42. Junio C HamanoFeb 16, 2009
  43. Jeff KingFeb 17, 2009
  44. Junio C HamanoFeb 17, 2009
  45. Jeff KingFeb 17, 2009
  46. Jeff KingFeb 16, 2009
  47. david@lang.hmFeb 16, 2009
  48. Jeff KingFeb 16, 2009
  49. david@lang.hmFeb 16, 2009
  50. Jeff KingFeb 16, 2009
  51. david@lang.hmFeb 16, 2009
  52. Jeff KingFeb 16, 2009
  53. Johannes SchindelinFeb 16, 2009
  54. dashed commands, was Re: disallowing push to currently checked-out branchJohannes Schindelin, Feb 16, 2009
  55. david@lang.hmFeb 15, 2009
  56. Johannes SchindelinFeb 15, 2009
  57. Junio C HamanoFeb 15, 2009
  58. david@lang.hmFeb 16, 2009
  59. Johannes SchindelinFeb 15, 2009
  60. david@lang.hmFeb 16, 2009
  61. Junio C HamanoFeb 16, 2009
  62. Johannes SchindelinFeb 16, 2009
  63. david@lang.hmFeb 16, 2009
  64. Sverre RabbelierFeb 16, 2009
  65. disallowing push to currently checked-out branchJeff King, Feb 16, 2009
  66. Sergio CallegariFeb 16, 2009
  67. Jakub NarebskiFeb 15, 2009
  68. Johannes SchindelinFeb 15, 2009
  69. Jakub NarebskiFeb 15, 2009
  70. david@lang.hmFeb 16, 2009
  71. send-email sending shallow threads by defaultJeff King, Feb 16, 2009
  72. Pieter de BieFeb 16, 2009
  73. Jeff KingFeb 16, 2009
  74. Brian GernhardtFeb 16, 2009
  75. Wincent ColaiutaFeb 16, 2009
  76. SZEDER GáborFeb 16, 2009
  77. Martin MaresFeb 16, 2009
  78. Andreas EricssonFeb 17, 2009
  79. Martin MaresFeb 17, 2009
  80. Jeff KingFeb 17, 2009
  81. Eric W. BiedermanFeb 20, 2009
  82. Jeff KingFeb 20, 2009
  83. Eric W. BiedermanFeb 20, 2009
  84. Andreas EricssonFeb 17, 2009
  85. Sitaram ChamartyFeb 16, 2009
  86. Björn SteinbrinkFeb 16, 2009
  87. Junio C HamanoFeb 16, 2009
  88. Björn SteinbrinkFeb 16, 2009
  89. [RFC - draft #2] List of proposed future changes that are backward incompatibleJunio C Hamano, Feb 16, 2009
  90. Jeff KingFeb 16, 2009
  91. Jakub NarebskiFeb 16, 2009

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.