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

Re: [PATCH v3 1/2] worktrees: add die_if_shared_symref

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2015, 20:08 UTC
Message-ID
<xmqqr3no3xau.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAPig+cTX0Wav2QSFi734uLVpjdmwFKzcesgkpmVKCPomMB_HyA@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 15 quoted lines
> On Fri, Jul 31, 2015 at 3:01 PM, David Turner <dturner@twopensource.com> wrote:
>> Add a new function, die_if_shared_symref, which works like
>> die_if_checked_out, but for all references.  Refactor
>> die_if_checked_out to work in terms of die_if_shared_symref.
>>
>> Soon, we will use die_if_shared_symref to protect notes merges in
>> worktrees.
>
> I wonder if the diagnostic:
>
>     'blorp' is already checked out at '/path/name/'
>
> emitted by check_linked_checkout() needs to be adjusted for this
> change. It still makes sense for die_if_checked_out(), but sounds odd
> for die_if_shared_symref().

True. Lift the dying one callstack up, and make the lower level helper check_shared_symref() or something that returns NULL (ok) or that '/path/name' upon an error?

Also I suspect that this comment will become hard to grok after the commit is actually made:

Show 6 quoted lines
>  	/*
> -	 * $GIT_COMMON_DIR/HEAD is practically outside
> +	 * $GIT_COMMON_DIR/$symref is practically outside
>  	 * $GIT_DIR so resolve_ref_unsafe() won't work (it
>  	 * uses git_path). Parse the ref ourselves.
>  	 */

A reviewer who is viewing both the pre- and post- text of the patch can see it used to say HEAD and now it is extended to $symref, but it would help to have "(e.g. HEAD)" after "...DIR/$symref", I think.

Previous: Eric SunshineNext: David Turner
Message 4 of 7 in “worktrees: add die_if_shared_symref”
  1. 1/2 worktrees: add die_if_shared_symrefDavid Turner, Jul 31, 2015
  2. 2/2 notes: handle multiple worktreesDavid Turner, Jul 31, 2015
  3. Eric SunshineJul 31, 2015
  4. Junio C HamanoJul 31, 2015
  5. David TurnerJul 31, 2015
  6. Eric SunshineJul 31, 2015
  7. David TurnerJul 31, 2015

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.