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

Re: A few "linked checkout" niggles

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 17, 2015, 17:02 UTC
Message-ID
<CAPig+cRSHwmmF9cCUbRrDCCW4kvg9PeOUxP5VQpSGfxzMxHWOQ@mail.gmail.com>
In-Reply-To
<CACsJy8BZEhMJPdw4K_kihA1kTPBVsAt=zW-cemzO7V+xfDih8Q@mail.gmail.com>
On Fri, Jul 17, 2015 at 8:49 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 15 quoted lines
> On Fri, Jul 17, 2015 at 7:27 PM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Two more observations:
>>
>> $ git worktree add /tmp/gitwt
>> Enter /tmp/gitwt (identifier gitwt)
>> Switched to a new branch 'gitwt'
>>
>> Now I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd
>> at the original branch.
>>
>> So either we cd to the new location or quelch these messages or add a
>> message that we're actually back.
>
> s/Enter/Preparing/ ?

Presumably you're using 'master'. The "Switched to a new branch" message is an artifact of using git-checkout for the back-end operation, however, what is queued in 'pu' no long uses git-checkout at all, so that message is gone.

I agree with Duy that s/Enter/Prepare/ would be a good idea. I don't think we want to drop the message altogether as Junio suggested since other messages such as "Checking out files:..." and "HEAD is now at...." follow it, thus "Prepare..." provides context indicating that those additional messages apply to the new worktree rather than the current one.

Show 16 quoted lines
>> The other:
>>
>> linked worktrees are prefect for short term tests on detached heads.
>> Even the manual page advertises detach. But:
>>
>> $ git worktree add  --detach /tmp/gitwtt
>> Enter /tmp/gitwtt (identifier gitwtt)
>> fatal: '--detach' cannot be used with '-b/-B/--orphan'
>>
>> Maybe it's the auto-naming logic stepping on detached toes ;)
>
> Problem with master (but not with pu) because "-b gitwtt" is
> automatically added. I think this is 1eb07d8 (worktree: add:
> auto-vivify new branch when <branch> is omitted - 2015-07-06)
> forgetting about --detach. Actually it's still a problem with 'pu'
> because the branch 'gitwtt' is created unnecessarily.

Yep. Again, that fatal error is an artifact from git-checkout being used as the back-end on 'master'. What is queued on 'pu' doesn't fail, however, as Duy notes, the auto-vivication incorrectly kicks in and creates a new branch unnecessarily. That'll have to be fixed in v3.

Previous: Eric Sunshine
Message 11 of 11 in “A few "linked checkout" niggles”
  1. Junio C HamanoJul 15, 2015
  2. Duy NguyenJul 16, 2015
  3. Eric SunshineJul 16, 2015
  4. Junio C HamanoJul 16, 2015
  5. Duy NguyenJul 16, 2015
  6. Eric SunshineJul 17, 2015
  7. Michael J GruberJul 17, 2015
  8. Duy NguyenJul 17, 2015
  9. Junio C HamanoJul 17, 2015
  10. Eric SunshineJul 17, 2015
  11. Eric SunshineJul 17, 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.