Re: [PATCH 4/7] contrib/subtree: Better Error Handling for add
- From
greened@obbligato.org <greened@obbligato.org>
- Date
- Jan 16, 2013, 03:21 UTC
- Message-ID
- <87r4llq0d6.fsf@waller.obbligato.org>
- In-Reply-To
- <7v7gnneco2.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 26 quoted lines
> "David A. Greene" <greened@obbligato.org> writes:
>
>> From: "David A. Greene" <greened@obbligato.org>
>>
>> Check refspecs for validity before passing them on to other commands.
>> This lets us generate more helpful error messages.
>>
>> Signed-off-by: David A. Greene <greened@obbligato.org>
>> ---
>> contrib/subtree/git-subtree.sh | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
>> index cac0680..d53eaee 100755
>> --- a/contrib/subtree/git-subtree.sh
>> +++ b/contrib/subtree/git-subtree.sh
>> @@ -508,12 +508,18 @@ cmd_add()
>> ensure_clean
>>
>> if [ $# -eq 1 ]; then
>> - "cmd_add_commit" "$@"
>> + git rev-parse -q --verify "$1^{commit}" >/dev/null ||
>> + die "'$1' does not refer to a commit"
>
> Where do these uneven indentation come from? Is it mimicking
> existing breakage in the script?Huh. I'm not sure how that happened. I'll fix it if you haven't got to it already.
-David