Re: [PATCH v4 3/3] clone: abort if no dir name could be guessed

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

 



Patrick Steinhardt <ps@xxxxxx> writes:

> Due to various components of the URI being stripped off it may
> happen that we fail to guess a directory name. We currently error
> out with a message that it is impossible to create the working
> tree '' in such cases. Instead, error out early with a sensible
> error message hinting that a directory name should be specified
> manually on the command line.

Sounds like a sensible thing to do.

>
> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  builtin/clone.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/builtin/clone.c b/builtin/clone.c
> index 7d93e13..5834978 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -214,6 +214,10 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
>  	len = end - start;
>  	strip_suffix_mem(start, &len, is_bundle ? ".bundle" : ".git");
>  
> +	if (!len || (len == 1 && *start == '/'))
> +	    die("No directory name could be guessed.\n"
> +		"Please specify a directory on the command line");
> +
>  	if (is_bare)
>  		dir = xstrfmt("%.*s.git", (int)len, start);
>  	else
--
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]