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

Re: [PATCH v3 3/3] worktree: make add <path> dwim

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Nov 22, 2017, 19:49 UTC
Message-ID
<20171122194937.GA11773@hank>
In-Reply-To
<xmqqh8tnyuq3.fsf@gitster.mtv.corp.google.com>
On 11/22, Junio C Hamano wrote:
Show 13 quoted lines
> Thomas Gummerer <t.gummerer@gmail.com> writes:
> 
> > I didn't consider that, I think you are right, and the flag should
> > apply in that case as well.  I think at that point we may as well pass
> > this flag through to the 'git branch' call, and let users set up
> > tracking if they want to, the same way it works in 'git branch'.
> 
> OK, so tracking is set up by default in the current implementation
> of "git worktree" (even without your proposed update), but we will
> stop doing so, and instead take an explicit "--track" option (or
> "--no-track" to countermand an earlier "--track" on the command line
> and/or a default configured with branch.autosetupmerge) just like
> "git branch" does?

I was a bit brief in the above. The full story is that tracking is set up by default if the '<branch>' given is a remote tracking branch, and isn't set up otherwise, the same way as 'git branch' behaves.

What I'm planning to do is introduce a --[no-]track flag to override this behaviour. As 'git worktree' really just calls 'git branch' internally, the branch.autoSetupMerge configuration is also respected.

> I think that it is very sensible thing to make sure that "branch",
> "checkout -b" and "worktree", i.e. the three ways to create a branch
> to work on (the latter two being short-hands), behave consistently.

So in summary "branch" and "worktree" already behave consistently, the plan is just to introduce the same "--[no-]track" flag as branch to allow users to override the behaviour the same way as they are allowed in "branch".

> Thanks.
Previous: Junio C Hamano
Message 28 of 28 in “checkout: factor out functions to new lib file”
  1. 1/2 checkout: factor out functions to new lib fileThomas Gummerer, Nov 12, 2017
  2. 2/2 worktree: make add dwimThomas Gummerer, Nov 12, 2017
  3. Junio C HamanoNov 13, 2017
  4. Thomas GummererNov 14, 2017
  5. Eric SunshineNov 14, 2017
  6. Eric SunshineNov 14, 2017
  7. Thomas GummererNov 15, 2017
  8. Thomas GummererNov 18, 2017
  9. Thomas GummererNov 15, 2017
  10. Eric SunshineNov 15, 2017
  11. Junio C HamanoNov 13, 2017
  12. Thomas GummererNov 14, 2017
  13. 1/3 checkout: factor out functions to new lib fileThomas Gummerer, Nov 18, 2017
  14. 2/3 worktree: make add <path> <branch> dwimThomas Gummerer, Nov 18, 2017
  15. Thomas GummererNov 18, 2017
  16. 3/3 worktree: make add <path> dwimThomas Gummerer, Nov 18, 2017
  17. 0/3 make git worktree add dwim moreThomas Gummerer, Nov 18, 2017
  18. 2/3 worktree: make add <path> <branch> dwimThomas Gummerer, Nov 18, 2017
  19. Eric SunshineNov 19, 2017
  20. Thomas GummererNov 19, 2017
  21. 1/3 checkout: factor out functions to new lib fileThomas Gummerer, Nov 18, 2017
  22. 3/3 worktree: make add <path> dwimThomas Gummerer, Nov 18, 2017
  23. Eric SunshineNov 19, 2017
  24. Eric SunshineNov 19, 2017
  25. Junio C HamanoNov 20, 2017
  26. Thomas GummererNov 21, 2017
  27. Junio C HamanoNov 22, 2017
  28. Thomas GummererNov 22, 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.