On Wed, Apr 16, 2008 at 01:03:22PM -0700, Junio C Hamano wrote: > > I was only working on making "HEAD" expand to HEAD:<current branch>. I > > think that the matching type is only most likely what you want, not > > certainly enough to just do it. I'd say that push should suggest it, but > > not actually do it automatically, or possibly require -f to do it without > > the full name. > > Hmm. `-f` means "I know there are the ones that do not fast forward but I > want them updated", which is quite a different thing. I'd say either we > should just do it, or we don't, and keep `-f` orthogonal to the ref > dwimming. Hmm. I was kind of hoping other people would chime in with opinions on the dwimmery, but clearly they didn't. I agree that "-f" is a terrible idea here. Not only is it overloading what "-f" does, but it's totally unnecessary. If we want to send a message to the user to retry with different parameters, we can already say: "try again with refs/heads/$foo". The "refs/heads/" dwimmery makes sense to me, because: 1. it changes a behavior which is currently an error condition, so we're not hurting anyone's existing workflow 2. In my usage, pushing a branch to a tag (or vice versa) is the exception, so I don't mind favoring pushing like types to like types. But I recognize that (2) is based on my own workflow, so if people disagree, I guess it isn't so for everyone. We should probably at least improve the message. Something like this is perhaps a bit better, or it could even customize the suggestion based on the source ref's type (i.e., implement the dwimmery, but don't surprise anyone by doing it automatically). -Peff --- diff --git a/remote.c b/remote.c index 06ad156..2151829 100644 --- a/remote.c +++ b/remote.c @@ -867,9 +867,12 @@ static int match_explicit(struct ref *src, struct ref *dst, if (!memcmp(dst_value, "refs/", 5)) matched_dst = make_linked_ref(dst_value, dst_tail); else - error("dst refspec %s does not match any " - "existing ref on the remote and does " - "not start with refs/.", dst_value); + error("The destination refspec does not match any " + "existing ref on the remote,\n" + "and it does not specify a full refname; " + "did you mean one of:\n" + " refs/heads/%s\n" + " refs/tags/%s\n", dst_value, dst_value); break; default: matched_dst = NULL; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html