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

Re: [PATCH 2/2] refs_resolve_ref_unsafe: handle d/f conflicts for writes

From
Jeff King <peff@peff.net>
Date
Oct 6, 2017, 17:16 UTC
Message-ID
<20171006171623.kjzeavnzopowvqzv@sigill.intra.peff.net>
In-Reply-To
<38c17fdc-7a3b-d166-1abe-afe64fc823c5@alum.mit.edu>
On Fri, Oct 06, 2017 at 07:09:10PM +0200, Michael Haggerty wrote:
Show 9 quoted lines
> I do have one twinge of uneasiness at a deeper level, that I haven't had
> time to check...
> 
> Does this patch make it easier to *set* HEAD to an unborn branch that
> d/f conflicts with an existing reference? If so, that might be a
> slightly worse UI for users. I'd rather learn about such a problem when
> setting HEAD (when I am thinking about the new branch name and am in the
> frame of mind to solve the problem) rather than later, when I try to
> commit to the new branch.

Good question. The answer is no, it's allowed both before and after my patch. At least via git-symbolic-ref.

I agree it would be nice to know earlier for such a case. For symbolic-ref, we probably should allow it, because it's plumbing that may be used for tricky things. For things like "checkout -b", you'd generally get a timely warning as we try to create the ref.

The odd man out is "checkout --orphan", which leaves the branch unborn. It might be nice if it did a manual check that the ref is available (and also that it's syntactically acceptable, though I think we may do that already).

But all of that is orthogonal to this fix, I think.
-Peff
Previous: Michael HaggertyNext: Michael Haggerty
Message 11 of 14 in “Regression in 'git branch -m'?”
  1. Andreas KreyOct 5, 2017
  2. Jeff KingOct 5, 2017
  3. Jeff KingOct 6, 2017
  4. Jeff KingOct 6, 2017
  5. Junio C HamanoOct 6, 2017
  6. Jeff KingOct 6, 2017
  7. Jeff KingOct 6, 2017
  8. 1/2 t3308: create a real ref directory/file conflictJeff King, Oct 6, 2017
  9. 2/2 refs_resolve_ref_unsafe: handle d/f conflicts for writesJeff King, Oct 6, 2017
  10. Michael HaggertyOct 6, 2017
  11. Jeff KingOct 6, 2017
  12. Michael HaggertyOct 7, 2017
  13. Michael HaggertyNov 5, 2017
  14. Junio C HamanoOct 7, 2017

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.