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

Re: [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref

From
Steffen Prohaska <prohaska@zib.de>
Date
Oct 31, 2007, 21:09 UTC
Message-ID
<B16F7DA1-E3E5-47A4-AFD3-6680741F38F1@zib.de>
In-Reply-To
<7vve8nglrt.fsf@gitster.siamese.dyndns.org>
On Oct 31, 2007, at 7:51 PM, Junio C Hamano wrote:
Show 20 quoted lines
> Steffen Prohaska <prohaska@zib.de> writes:
>
>> On Oct 31, 2007, at 9:45 AM, Junio C Hamano wrote:
>>
>>> I would not doubt it would be safer for _your_ workflow, but you
>>> should consider the risk of making things more cumbersome for
>>> workflows of others by enforcing that policy.
>>
>> Together with the '--create' flag it would be safer in all
>> cases, because it would always do _less_ than what git push
>> currently does. The safest choice would be if "git push"
>> refused to do anything until configured appropriately.
>>
>> "safer" is independent of the workflow.
>
> By your definition, a command that does not do anything by
> default is safer regardless of the workflow.
>
> That may be theoretically true --- it cannot do any harm by
> default.  But that is not useful.

If different workflows have contradicting needs, doing nothing by default might be a good choice. Not theoretically, but in practice.

Show 10 quoted lines
>> I'm mainly interested in using git against a shared repo,
>> and make it as simple and as safe as possible to use in
>> such a setup. I suspect that git is more optimized for the
>> workflow used for the Linux kernel and for developing git,
>> which heavily rely on sending patches to mailing lists and
>> pulling from read-only repos.
>>
>
> You forgot a lot more important part.  Pushing into publishing
> repositories.  And the discussion is about git-push command.
Exactly, here are two examples:

If you push only to publishing repositories that are read only by others, you'll never encounter the problem that 10/10 tried to solve. The publishing repository is never changed by others. You are the only one who pushes to this repository. Therefore the remote never advances unexpectedly.

A shared repository behaves differently. Others push to the repository as well. Hence, branches can advance unexpectedly.

Another difference is the way changes are integrated. In a workflow without shared repositories, only pull is used for integration, while push in only used for publishing the changes. After a push you always need to request someone else to pull. For example:

- Alice publishes branch foo.
- Bob clones Alice's repository and checks out foo as his
   local branch bar.
- Bob later publishes his branch by pushing bar to his
   public repository and asks Alice to pull.
- Alice pulls bar from Bobs public repository and merges
   with foo. She then publishes the integrated changes
   by pushing foo to her public repository.

My point is: there is no need to push from branch bar to branch foo. Alice and Bob both push to branches that are named identical in their private and their public repositories. Only pull is used to merge changes from the branch named bar to the branch named foo.

This is different if you work with a shared repository. Bob checks out the shared branch foo to his local branch bar and later he needs to push bar back to the shared branch foo. Bob needs to push changes from his local branch bar to the branch foo in the remote repository, a branch with a different name. This need does not emerge when working with two publishing repositories, as described above.

This was the extended version of what I meant above. The workflow used for the Linux kernel and for developing git is focused on pull. Push is normally only used for publishing branches under identical name. The interesting stuff happens during the pull.

	Steffen
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 53 in “improve refspec handling in push”
  1. 0/10 improve refspec handling in pushSteffen Prohaska, Oct 28, 2007
  2. 01/10 push: change push to fail if short refname does not existSteffen Prohaska, Oct 28, 2007
  3. 02/10 push: teach push new flag --createSteffen Prohaska, Oct 28, 2007
  4. 03/10 push: support pushing HEAD to real branch nameSteffen Prohaska, Oct 28, 2007
  5. 04/10 push: add "git push HEAD" shorthand for 'push current branch to default repo'Steffen Prohaska, Oct 28, 2007
  6. 05/10 rename ref_matches_abbrev() to ref_abbrev_matches_full_with_fetch_rules()Steffen Prohaska, Oct 28, 2007
  7. 06/10 add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref nameSteffen Prohaska, Oct 28, 2007
  8. 07/10 push: use same rules as git-rev-parse to resolve refspecsSteffen Prohaska, Oct 28, 2007
  9. 08/10 push: teach push to accept --verbose optionSteffen Prohaska, Oct 28, 2007
  10. 09/10 push: teach push to pass --verbose option to transport layerSteffen Prohaska, Oct 28, 2007
  11. 10/10 push: teach push to be quiet if local ref is strict subset of remote refSteffen Prohaska, Oct 28, 2007
  12. Junio C HamanoOct 30, 2007
  13. Steffen ProhaskaOct 30, 2007
  14. Andreas EricssonOct 30, 2007
  15. Steffen ProhaskaOct 30, 2007
  16. Junio C HamanoOct 30, 2007
  17. Steffen ProhaskaOct 31, 2007
  18. Junio C HamanoOct 31, 2007
  19. Junio C HamanoOct 31, 2007
  20. Steffen ProhaskaOct 31, 2007
  21. Junio C HamanoOct 31, 2007
  22. Steffen ProhaskaOct 31, 2007
  23. Junio C HamanoOct 31, 2007
  24. Steffen ProhaskaNov 1, 2007
  25. Andreas EricssonNov 1, 2007
  26. Steffen ProhaskaNov 1, 2007
  27. Junio C HamanoNov 1, 2007
  28. Steffen ProhaskaNov 2, 2007
  29. Junio C HamanoNov 2, 2007
  30. Steffen ProhaskaNov 2, 2007
  31. Junio C HamanoNov 2, 2007
  32. Steffen ProhaskaNov 2, 2007
  33. Andreas EricssonNov 2, 2007
  34. Tom PrinceNov 2, 2007
  35. Andreas EricssonNov 2, 2007
  36. Steffen ProhaskaNov 2, 2007
  37. Junio C HamanoNov 2, 2007
  38. Junio C HamanoNov 2, 2007
  39. Andreas EricssonNov 1, 2007
  40. Steffen ProhaskaNov 1, 2007
  41. Andreas EricssonNov 1, 2007
  42. Wincent ColaiutaNov 2, 2007
  43. Johannes SchindelinNov 2, 2007
  44. Steffen ProhaskaNov 2, 2007
  45. Wincent ColaiutaNov 2, 2007
  46. Daniel BarkalowOct 30, 2007
  47. Junio C HamanoOct 30, 2007
  48. Steffen ProhaskaOct 30, 2007
  49. Junio C HamanoOct 30, 2007
  50. Junio C HamanoOct 30, 2007
  51. Junio C HamanoOct 30, 2007
  52. Steffen ProhaskaOct 30, 2007
  53. Junio C HamanoOct 30, 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.