Re: [PATCH v2 1/2] help: add help_unknown_ref

2013-05-09 Thread Vikrant Varma
On Thursday 09 May 2013 04:19 AM, Junio C Hamano wrote: [...] which in turn made me realize that some commands may not even know if the user mistyped a ref. It is not an objection to this patch per-se, but a useful future enhancement may be to allow the callers call guess_mistyped_ref()

[PATCH v2 0/2] Show suggested refs when ref unknown

2013-05-03 Thread Vikrant Varma
blanket failure error messages (eg. git checkout foo). Vikrant Varma (2): help: add help_unknown_ref merge: use help_unknown_ref builtin/merge.c |3 ++- help.c | 50 ++ help.h |5 + 3 files changed, 57 insertions(+), 1

[PATCH v2 1/2] help: add help_unknown_ref

2013-05-03 Thread Vikrant Varma
merge Did you mean one of these? origin/foo upstream/foo Signed-off-by: Vikrant Varma vikrant.varm...@gmail.com --- help.c | 50 ++ help.h |5 + 2 files changed, 55 insertions(+) diff --git a/help.c b

[PATCH v2 2/2] merge: use help_unknown_ref

2013-05-03 Thread Vikrant Varma
Use help.c:help_unknown_ref instead of die to provide a friendlier error message before exiting, when one of the refs specified in a merge is unknown. Signed-off-by: Vikrant Varma vikrant.varm...@gmail.com --- builtin/merge.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH 0/2] Better advice on merge

2013-05-01 Thread Vikrant Varma
, instead of providing blanket failure error messages (eg. git checkout foo). Vikrant Varma (2): help: add help_unknown_ref merge: use help_unknown_ref instead of die builtin/merge.c | 4 ++-- help.c | 44 help.h | 6 ++ 3 files

[PATCH 1/2] help: add help_unknown_ref

2013-05-01 Thread Vikrant Varma
Give better advice when trying to merge a branch that doesn't exist. If the branch exists in any remotes, display a list of suggestions. Example: $ git merge foo fatal: foo - not something we can merge Did you mean this? bar/foo Signed-off-by: Vikrant Varma

[PATCH 2/2] merge: use help_unknown_ref instead of die

2013-05-01 Thread Vikrant Varma
The previous patch added help_unknown_ref to print a more helpful error message when trying to merge a branch that doesn't exist, by printing a list of remote branches the user might have meant. Use it. Signed-off-by: Vikrant Varma vikrant.varm...@gmail.com --- builtin/merge.c | 4 ++-- 1 file

Re: [PATCH 1/2] help: add help_unknown_ref

2013-05-01 Thread Vikrant Varma
On 01-05-2013 17:53, Ramkumar Ramachandra wrote: Vikrant Varma wrote: Give better advice when trying to merge a branch that doesn't exist. If the branch exists in any remotes, display a list of suggestions. Interesting. Thanks for working on this. You say advice, but you're not invoking

Re: [PATCH 1/2] help: add help_unknown_ref

2013-05-01 Thread Vikrant Varma
On 02-05-2013 02:02, Ramkumar Ramachandra wrote: ref_cb.similar_refs has already been defined. The compiler won't let me assign to it unless I cast first. However, I think compound literals are a C99/gcc feature. Is this better? struct similar_ref_cb ref_cb = {ref,

Re: [PATCH 1/2] help: add help_unknown_ref

2013-05-01 Thread Vikrant Varma
On 02-05-2013 00:05, Junio C Hamano wrote: If you step back a bit, you would notice two things. (1) Saying 'foo' when the user means 'origin/foo' is hardly the only (or even the most common) kind of mistake that the code you need to add to 'git merge' would encounter and could

Re: [PATCH 0/2] Better advice on merge

2013-05-01 Thread Vikrant Varma
On 01-05-2013 23:57, Jonathan Nieder wrote: - It would be nice to add a test under t/ Thanks, I'll do that. - Since the first patch isn't useful without or logically separate from the second, this would probably be easier to read as a single patch. They are logically