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

Re: [RFC PATCH 0/4] deny push to current branch of non-bare repo

From
KMKyle Moffett <kyle@moffetthome.net>
Date
Nov 13, 2008, 13:58 UTC
Message-ID
<f73f7ab80811130558h34cb1220q76ef5536e853151c@mail.gmail.com>
In-Reply-To
<7vhc6ci24o.fsf@gitster.siamese.dyndns.org>
On Thu, Nov 13, 2008 at 1:14 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Jeff King <peff@peff.net> writes:
>> And then the "push to current branch" problem is neatly solved: you have
>> no current branch.
>>
>> So:
>>
>>   $ git checkout new/branch/to/test^0
>>   $ make, configure, etc
>
> Exactly.
>
> I keep a handful pseudo worktrees around (created with git-new-workdir on
> top of a single repository) for quick patch test and build purposes.  I do
> not push into them but pushing into a non-bare repository and checking out
> the same branch twice in such a setup share exactly the same issue, and I
> keep their HEADs all detached for exactly the same reason.

I guess the issue comes down to a UI complication. It would very easy for me to tell somebody how to check out and test their branch in my testbed if I'm not around, except for that little bit of arcane syntax. Moreover, the consequences if they forget are really frustrating and hard to figure out. It's also very easy with a GUI to do the simple *rightclick branch, click "Checkout"*, but would be much harder to do the detached HEAD checkout correctly.

If it didn't involve reconfiguring a lot of other people's repositories, I might consider having them push to "refs/remotes/*". In theory that's actually much closer to what I'm doing anyways. That would force any checkouts to be bare, but it would require lots of git-foo on the pushing side. Perhaps some way to "git push" which asks the remote repository where it wants the stuff?

Alternatively, it might be possible to add ref attributes or a config option to force detached HEAD checkouts.

Cheers, Kyle Moffett

Previous: Junio C HamanoNext: Jeff King
Message 19 of 25 in “deny push to current branch of non-bare repo”
  1. 0/4 deny push to current branch of non-bare repoJeff King, Nov 7, 2008
  2. 1/4 t5400: expect success for denying deletionJeff King, Nov 7, 2008
  3. Jan KrügerNov 9, 2008
  4. 2/4 t5516: refactor oddball testsJeff King, Nov 7, 2008
  5. 3/4 tests: avoid pushing to current branch of non-bare repoJeff King, Nov 7, 2008
  6. 4/4 receive-pack: deny push to current branch of non-bare repoJeff King, Nov 7, 2008
  7. Mark BurtonNov 7, 2008
  8. Junio C HamanoNov 7, 2008
  9. Jeff KingNov 8, 2008
  10. Johannes SchindelinNov 8, 2008
  11. Junio C HamanoNov 8, 2008
  12. Jeff KingNov 9, 2008
  13. Junio C HamanoNov 9, 2008
  14. Kyle MoffettNov 12, 2008
  15. Jeff KingNov 12, 2008
  16. Kyle MoffettNov 13, 2008
  17. Jeff KingNov 13, 2008
  18. Junio C HamanoNov 13, 2008
  19. Kyle MoffettNov 13, 2008
  20. Jeff KingNov 14, 2008
  21. Leo RazoumovDec 2, 2008
  22. Junio C HamanoDec 2, 2008
  23. Leo RazoumovDec 2, 2008
  24. Jeff KingDec 2, 2008
  25. Leo RazoumovDec 2, 2008

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.