Re: [PATCH] git-init: inform user of `git --bare init' option

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

 



Luciano Rocha <luciano@xxxxxxxxxxx> writes:

> Creation of a bare repository isn't consistent:
>
> $ git init --bare
> usage: git-init [-q | --quiet] [--template=<template-directory>] [--shared]
> $ git --bare init
> Initialized empty Git repository in ...

The examples do not demonstrate that "it isn't consistent".  It just
demonstrates that it is easy for people to forget that --bare option is an
option to the "git" potty itself and not an option to "git init".

> diff --git a/builtin-init-db.c b/builtin-init-db.c
> index a76f5d3..65454b1 100644
> --- a/builtin-init-db.c
> +++ b/builtin-init-db.c
> @@ -334,6 +334,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
>  			template_dir = arg+11;
>  		else if (!strcmp(arg, "--shared"))
>  			shared_repository = PERM_GROUP;
> +		else if (!strcmp(arg, "--bare"))
> +			die("Run `git --bare init' instead to create a bare repository");
>  		else if (!prefixcmp(arg, "--shared="))
>  			shared_repository = git_config_perm("arg", arg+9);
>  		else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))

Given that you are adding a special case support for "git init --bare"
anyway, a better approach to help people out of this easy confusion (and
we have to admit that the confusion is very easy!) would be to make "git
init --bare" pretend/behave as if the user said "git --bare init", don't
you think?

--
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]

  Powered by Linux