Re: [PATCH 4/7] contrib/subtree: Better Error Handling for add

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

 



"David A. Greene" <greened@xxxxxxxxxxxxx> writes:

> From: "David A. Greene" <greened@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> ---
>  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?

> +
> +	    "cmd_add_commit" "$@"
>  	elif [ $# -eq 2 ]; then
> -		"cmd_add_repository" "$@"
> +	    git rev-parse -q --verify "$2^{commit}" >/dev/null ||
> +            die "'$2' does not refer to a commit"
> +
> +	    "cmd_add_repository" "$@"
>  	else
>  	    say "error: parameters were '$@'"
> -	    die "Provide either a refspec or a repository and refspec."
> +	    die "Provide either a commit or a repository and commit."
>  	fi
>  }
--
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]