Re: [PATCH 1/1] Improve error messages from 'git stash show'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gustaf Hendeby <hendeby@xxxxxxxxxx> writes:

> On 03/16/2010 12:17 AM, Junio C Hamano wrote:
>> Gustaf Hendeby <hendeby@xxxxxxxxxx> writes:
>> 
>>> The previous error message "fatal: Needed a single revision" is not
>>> very informative.
>>>
>>> Signed-off-by: Gustaf Hendeby <hendeby@xxxxxxxxxx>
>>> ---
>>>  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

That is more like "'foo' is not a stash", isn't it?
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]