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

Re: [PATCH] worktree add: introduce basic DWYM for --orphan

From
Jacob Abel <jacobabel@nullpo.dev>
Date
Jan 18, 2023, 20:43 UTC
Message-ID
<20230118204323.gn6rs3gydybsqt4g@phi>
In-Reply-To
<cddc6987-3b58-4688-65f8-3da0fbd1cc51@dunelm.org.uk>
On 23/01/16 10:52AM, Phillip Wood wrote:
Show 44 quoted lines
> Hi Jacob
>
> On 14/01/2023 22:50, Jacob Abel wrote:
> > Introduces a DWYM shorthand of --orphan for when the worktree directory
> > and the to-be-created branch share the same name.
> >
> > Current Behavior:
> >      % git worktree list
> >      /path/to/git/repo        a38d39a4c5 [main]
> >      % git worktree add --orphan new_branch ../new_branch/
> >      Preparing worktree (new branch 'new_branch')
> >      % git worktree add --orphan ../new_branch2/
> >      usage: git worktree add [<options>] <path> [<commit-ish>]
> >         or: git worktree list [<options>]
> >      [...]
> >      %
> >
> > New Behavior:
> >
> >      % git worktree list
> >      /path/to/git/repo        a38d39a4c5 [main]
> >      % git worktree add --orphan new_branch ../new_branch/
> >      Preparing worktree (new branch 'new_branch')
> >      % git worktree list
> >      /path/to/git/repo        a38d39a4c5 [main]
> >      /path/to/git/new_branch  a38d39a4c5 [new_branch]
> >      % git worktree add --orphan ../new_branch2/
> >      Preparing worktree (new branch 'new_branch2')
> >      % git worktree list
> >      /path/to/git/repo        a38d39a4c5 [main]
> >      /path/to/git/new_branch  a38d39a4c5 [new_branch]
> >      /path/to/git/new_branch2 a38d39a4c5 [new_branch2]
> >      %
>
> Thanks for working on this. As I said in my previous mail I think it
> would be easier to use OPT_BOOL() for --orphan from the start. By using
> OPT_STRING() you'll run into problems with "git worktree add --orphan
> --lock <directory>"
>
> Best Wishes
>
> Phillip
>
> > [...]
Ah, good point. I missed that.

Also given the way the conversation is going, I'll drop this patch and integrate the changes into the patches of the main series since I'll be re-rolling.

Previous: Phillip Wood
Message 4 of 4 in “worktree add: introduce basic DWYM for --orphan”
  1. worktree add: introduce basic DWYM for --orphanJacob Abel, Jan 14, 2023
  2. Jacob AbelJan 14, 2023
  3. Phillip WoodJan 16, 2023
  4. Jacob AbelJan 18, 2023

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.