From: Junio C Hamano Date: Tue, 15 Apr 2008 01:28:44 GMT Subject: Re: [PATCH] Make core.sharedRepository more generic (version 3) Message-ID: <7v7iez7voz.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20080415004246.GA13178@zakalwe.fi> Heikki Orsila 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=" 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.