[PATCH 0/2] Better advice on merge

2013-05-01 Thread Vikrant Varma
If origin/foo exists, but foo doesn't:

   $ git merge foo
   fatal: foo - not something we can merge

This patch series improves the error message. If a remote branch exists 
with the same name, it now says:

 $ git merge foo
 fatal: foo - not something we can merge

 Did you mean this?
 origin/foo

It does this by adding a new help function, help_unknown_ref, that takes 
care of printing the more friendly error message, and modifies builtin/merge.c
to use it. In the future, this could also be extended to other operations
involving branches that don't exist locally, 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 changed, 52 insertions(+), 2 deletions(-)

-- 
1.8.3-rc0

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2013-05-01 Thread Jonathan Nieder
Vikrant Varma wrote:

 If origin/foo exists, but foo doesn't:

$ git merge foo
fatal: foo - not something we can merge

 This patch series improves the error message. If a remote branch exists 
 with the same name, it now says:

  $ git merge foo
  fatal: foo - not something we can merge

  Did you mean this?
origin/foo

Fun. :)

I haven't looked at the patches closely.  My only immediate thoughts
are:

 - It would be nice to add a test under t/, so we can be sure without
   manually testing it that this new feature doesn't break in the
   future.  See t/README if interested.  I guess it would be t7613.

 - 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.

Thanks for your work, and hope that helps.

Sincerely,
Jonathan
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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 separate, even if the first isn't useful without the 
second. I wanted to segregate the task of defining a helper function 
that corrects the ref name, and changing the parts of the code that 
should use it. The reason the second is separate is that once the first 
is in place, even commands like 'checkout' can use the helper function.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html