Re: [PATCH] shared repository settings enhancement.

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

 




On Fri, 9 Jun 2006, Junio C Hamano wrote:
> 
> Yes, the user can mistype "gruop", people would start making
> noises about having "world" as a synonym for "everybody", and
> the parsing becomes somewhat cumbersome, and all that trouble,
> but on the other hand that is probably the easiest to explain.

Actually, it's quite easy to parse using the git config file parsers.

Let's say that 0 means umask, 1 means group, 2 means user and 3 means 
everybody. That leaves "0/1" with the old false/true behaviour, and leaves 
umask as the default.

So we'd have

	enum sharedrepo {
		PERM_UMASK = 0,
		PERM_GROUP,
		PERM_USER,
		PERM_EVERYBODY
	};

	int git_config_perm(const char *var, const char *value)
	{
		if (!strncmp(value, "umask"))
			return PERM_UMASK;
		if (!strncmp(value, "group"))
			return PERM_GROUP;
		if (!strncmp(value, "user"))
			return PERM_USER;
		if (!strncmp(value, "world") || !strncmp(value, "everybody"))
			return PERM_EVERYBODY;
		return git_config_bool(var, value);
	}

and then in check_repository_format_version() you just have

	..
	else if (strcmp(var, "core.sharedrepository") == 0)
		shared_repository = git_config_perm(var, value);
	..

instead of git_config_bool() there, and you're done. That's not so bad, is 
it?

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