Re: [PATCH/RFC] builtin-checkout: suggest creating local branch when appropriate to do so
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Oct 6, 2009, 07:32 UTC
- Message-ID
- <200910060932.24377.trast@student.ethz.ch>
- In-Reply-To
- <20091005225611.GB29335@coredump.intra.peff.net>
Jeff King wrote:
Show 22 quoted lines
> On Mon, Oct 05, 2009 at 11:17:09PM +0200, Johannes Schindelin wrote: > > > > $ git checkout next > > > error: pathspec 'next' did not match any file(s) known to git. > > > > 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? > > 2. What do we do if our lookup is ambiguous (e.g., "origin/next" and > "foobar/next" both exist)? > > 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?
If I may add another:
4. Are there any (scripted?) use-cases where git-checkout should fail because it was given an invalid branch name?
The following gives a hint, though they could of course be fixed and the ^0 case doesn't really count:
$ git grep 'git checkout .*||' -- "*.sh" git-bisect.sh: git checkout "$start_head" -- || exit git-rebase--interactive.sh: output git checkout $first_parent 2> /dev/null || git-rebase--interactive.sh: output git checkout "$1" || git-rebase.sh:git checkout -q "$onto^0" || die "could not detach HEAD" t/t2007-checkout-symlink.sh:git checkout -f master || exit
--
Thomas Rast
trast@{inf,student}.ethz.ch