git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Heikki Orsila <heikki.orsila@iki.fi>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Make core.sharedRepository more generic (version 3)
Date: Mon, 14 Apr 2008 18:28:44 -0700	[thread overview]
Message-ID: <7v7iez7voz.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080415004246.GA13178@zakalwe.fi> (Heikki Orsila's message of "Tue, 15 Apr 2008 03:42:46 +0300")

Heikki Orsila <heikki.orsila@iki.fi> 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.

      reply	other threads:[~2008-04-15  1:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-15  0:42 [PATCH] Make core.sharedRepository more generic (version 3) Heikki Orsila
2008-04-15  1:28 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v7iez7voz.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=heikki.orsila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).