Ævar Arnfjörð Bjarmason  <ava...@gmail.com> writes:

> Improve the error message added in f8aae12034 ("push: allow
> unqualified dest refspecs to DWIM", 2008-04-23), which before this
> change looks like this:
>
>     $ git push avar v2.19.0^{commit}:newbranch -n
>     error: unable to push to unqualified destination: newbranch
>     The destination refspec neither matches an existing ref on the remote nor
>     begins with refs/, and we are unable to guess a prefix based on the 
> source ref.
>     error: failed to push some refs to 'g...@github.com:avar/git.git'
>
> This message needed to be read very carefully to spot how to fix the
> error, i.e. to push to refs/heads/newbranch. Now the message will look
> like this instead:
>
>     $ ./git-push avar v2.19.0^{commit}:newbranch -n
>     error: The destination you provided is not a full refname (i.e.,
>     starting with "refs/"). We tried to guess what you meant by:
>
>     - Looking for a ref that matches 'newbranch' on the remote side.
>     - Checking if the <src> being pushed ('v2.19.0^{commit}')
>       is a ref in "refs/{heads,tags}/". If so we add a
>       corresponding refs/{heads,tags}/ prefix on the remote side.

If so, we would have added ..., but we couldn't, because <src> was
not such a local ref.

But is that a useful/actionable piece of information?  The user said
v2.19.0^{commit} because there was no such local ref the user could
have used instead to allow the DWIM to work on the destination side.

Perhaps it may be a good thing to remember for the next time, but it
does not help the user at all while redoing this failed push.

>     Neither worked, so we gave up. You must fully-qualify the ref.
>     error: failed to push some refs to 'g...@github.com:avar/git.git'

I am not sure if this is an improvement, quite honestly.  

The only part that directly matters to the end user and is is more
understandable than the original is "You must fully qualify the ref"
(by the way, that dash is probably not what you want).  As I already
said, "if this were local ref we can guess the location, it would
have worked better" is not relevant to the end user, so it is a
better use of the extra bytes to explain what it is to "fully"
qualify the ref, than telling what would have helped us make a
better guess.  Perhaps something along the lines of...

        'newbranch' does not match any existing ref on the remote
        side.  Please fully specify the destination refname starting
        from "refs/" (e.g. "v2.19.0^{commit}:refs/heads/newbranch"
        for creating a "newbranch" branch).

Reply via email to