Re: [PATCH] Make core.sharedRepository more generic (version 3)

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

 



Heikki Orsila <heikki.orsila@xxxxxx> writes:

> Version 2 handles the directory x flags better than version 1.
>
> Version 3 removes a warning for the o+w case, fixes a compatibility
> problem with older Git's, and corrects some style issues.

These four lines should come after "---", as you will have only one commit
in the history for this topic, and the original and the version 2 won't be
there.

> diff --git a/builtin-init-db.c b/builtin-init-db.c
> index 2854868..f49fea0 100644
> --- a/builtin-init-db.c
> +++ b/builtin-init-db.c
> @@ -400,9 +400,12 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
>  		char buf[10];
>  		/* We do not spell "group" and such, so that
>  		 * the configuration can be read by older version
> -		 * of git.
> +		 * of git. Note, we use octal numbers for new share modes.
>  		 */
> -		sprintf(buf, "%d", shared_repository);
> +		if (shared_repository <= 2)
> +			sprintf(buf, "%d", shared_repository);
> +		else
> +			sprintf(buf, "0%o", shared_repository);

Hmmmm.  shared_repostiory variable is assigned the return value of
git_config_perm() and that function does not return OLD_* variants (which
is a good thing to do), so I do not think if it can ever be "<= 2".

When running "git init" without "--shared" or "--shared=<something>" in an
repository already initialized with git 1.5.5 or order as "shared", I
think you rewrite .git/config to use 0660.  You would need something like
this instead:

	if (shared_repository == PERM_GROUP)
        	strcpy(buf, "1");
	else if (shared_repository == PERM_EVERYBODY))
        	strcpy(buf, "2");
	else ...

> +	/*
> +	 * Mask filemode value. Others can not get write permission.
> +	 * x flags for directories are handled separately.
> +	 */
> +	return i & 0664;

You are still dropping o+w even when the user explicitly asks for it, and
you are not telling that you are disobeying the user anymore.




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