git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustaf Hendeby <hendeby@isy.liu.se>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] Improve error messages from 'git stash show'
Date: Tue, 16 Mar 2010 09:04:59 +0100	[thread overview]
Message-ID: <4B9F3BAB.10608@isy.liu.se> (raw)
In-Reply-To: <7vbpepb2e9.fsf@alter.siamese.dyndns.org>

On 03/16/2010 12:17 AM, Junio C Hamano wrote:
> Gustaf Hendeby <hendeby@isy.liu.se> writes:
> 
>> The previous error message "fatal: Needed a single revision" is not
>> very informative.
>>
>> Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
>> ---
>>  git-stash.sh |    8 ++++++--
>>  1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-stash.sh b/git-stash.sh
>> index aa47e54..cf221c6 100755
>> --- a/git-stash.sh
>> +++ b/git-stash.sh
>> @@ -210,14 +210,18 @@ list_stash () {
>>  }
>>  
>>  show_stash () {
>> +	have_stash || die 'No stash found'
>> +
>>  	flags=$(git rev-parse --no-revs --flags "$@")
>>  	if test -z "$flags"
>>  	then
>>  		flags=--stat
>>  	fi
>>  
>> -	w_commit=$(git rev-parse --verify --default $ref_stash "$@") &&
>> -	b_commit=$(git rev-parse --verify "$w_commit^") &&
>> +	w_commit=$(git rev-parse --quiet --verify --default $ref_stash "$@") &&
>> +	b_commit=$(git rev-parse --quiet --verify "$w_commit^") ||
>> +		die 'Stash not found'
>> +
> 
> Because you checked have_stash upfront, an error detected here cannot be
> "stash not found".  It is something else, isn't it?

This case occurs when you do something like git stash foo, where foo is
no appropriate stash to show.  Would something like this be more
informative in the case of git stash foo:

Stash entry 'foo' could not be found

/Gustaf

  reply	other threads:[~2010-03-16  8:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15 22:19 [PATCH 1/1] Improve error messages from 'git stash show' Gustaf Hendeby
2010-03-15 23:17 ` Junio C Hamano
2010-03-16  8:04   ` Gustaf Hendeby [this message]
2010-03-16 16:53     ` Junio C Hamano
2010-03-16 17:52       ` [PATCH v2] " Gustaf Hendeby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B9F3BAB.10608@isy.liu.se \
    --to=hendeby@isy.liu.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).