Re: [PATCH/RFC] builtin-checkout: suggest creating local branch when appropriate to do so
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 6, 2009, 09:12 UTC
- Message-ID
- <alpine.DEB.1.00.0910061111410.4985@pacific.mpi-cbg.de>
- In-Reply-To
- <20091005225611.GB29335@coredump.intra.peff.net>
Hi,
On Mon, 5 Oct 2009, Jeff King wrote:
Show 21 quoted lines
> On Mon, Oct 05, 2009 at 11:17:09PM +0200, Johannes Schindelin wrote: > > > > $ git clone git://git.kernel.org/pub/scm/git/git.git > > > $ cd git > > > $ git checkout next > > > error: pathspec 'next' did not match any file(s) known to git. > > > To create a local branch from the same named remote branch, use > > > git checkout -b next origin/next > > > > > > Motivated by http://article.gmane.org/gmane.comp.version-control.git/129528 > > > > Actually, we should really think long and hard why we should not > > automatically check out the local branch "next" in that case. I mean, > > really long and hard, and making sure to take user-friendliness into > > account at least as much as simplicity of implementation. > > Some devil's advocate questions: > > 1. How do we find "origin/next" given "next"? What are the exact > lookup rules? Do they cover every case? Do they avoid surprising > the user?
I am sure your strategy would be the same as mine: enumerate all remote branches, strip the remote nickname, and compare. If there are ambiguities, tell the user and stop.
> 2. What do we do if our lookup is ambiguous (e.g., "origin/next" and > "foobar/next" both exist)?
See above.
> > 3. If our lookup does have ambiguities or corner cases, is it better > to simply be suggesting to the user, rather than proceeding with an > action?
See above.
Ciao, Dscho