public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Michael Haggerty <mhagger@alum•mit.edu>
Cc: "Eric Wong" <normalperson@yhbt•net>,
	"Karsten Blees" <karsten.blees@gmail•com>,
	"Stefan Beller" <stefanbeller@gmail•com>,
	"Torsten Bögershausen" <tboegi@web•de>,
	"Matthieu Moy" <Matthieu.Moy@imag•fr>,
	git@vger•kernel.org
Subject: Re: [PATCH v2 1/2] create_default_files(): don't set u+x bit on $GIT_DIR/config
Date: Sun, 16 Nov 2014 11:08:27 -0800	[thread overview]
Message-ID: <xmqqk32vyndg.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1416122508-30654-2-git-send-email-mhagger@alum.mit.edu> (Michael Haggerty's message of "Sun, 16 Nov 2014 08:21:47 +0100")

Michael Haggerty <mhagger@alum•mit.edu> writes:

> Since time immemorial, the test of whether to set "core.filemode" has
> been done by trying to toggle the u+x bit on $GIT_DIR/config and then
> testing whether the change "took". It is somewhat odd to use the
> config file for this test, but whatever.

The last sentence should read "We could create a test file and use
it for this purpose and then remove it, but config is a file we know
exists at this point in the code (and it is the only file we know
that exists), so it was a very sensible trick".

Or remove it altogether.  In other words, do not sound as if you do
not know what you are doing in your log message.  That would rob
confidence in the change from the person who is reading "git log"
output later.

> @@ -255,6 +255,7 @@ static int create_default_files(const char *template_path)
>  		filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) &&
>  				!lstat(path, &st2) &&
>  				st1.st_mode != st2.st_mode);
> +		filemode &= !chmod(path, st1.st_mode);

Sounds good.

You could also &&-chain this "flip it back" to the above statement.
If filemode is not trustable on a filesytem, doing one extra chmod()
to correct would not help us anyway, no?


>  	}
>  	git_config_set("core.filemode", filemode ? "true" : "false");

  reply	other threads:[~2014-11-16 19:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16  7:21 [PATCH v2 0/2] Don't make $GIT_DIR executable Michael Haggerty
2014-11-16  7:21 ` [PATCH v2 1/2] create_default_files(): don't set u+x bit on $GIT_DIR/config Michael Haggerty
2014-11-16 19:08   ` Junio C Hamano [this message]
2014-11-17  9:35     ` Michael Haggerty
2014-11-17  1:40   ` Eric Sunshine
2014-11-17  9:08     ` Torsten Bögershausen
2014-11-17 11:32       ` Michael Haggerty
2014-11-17  9:46     ` Michael Haggerty
2014-11-17 15:42       ` Junio C Hamano
2014-11-17 16:19         ` Michael Haggerty
2014-11-17 16:43           ` Junio C Hamano
2014-11-16  7:21 ` [PATCH v2 2/2] config: clear the executable bits (if any) " Michael Haggerty
2014-11-16  8:06   ` Johannes Sixt
2014-11-17  9:03     ` Michael Haggerty

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=xmqqk32vyndg.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@imag$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=karsten.blees@gmail$(echo .)com \
    --cc=mhagger@alum$(echo .)mit.edu \
    --cc=normalperson@yhbt$(echo .)net \
    --cc=stefanbeller@gmail$(echo .)com \
    --cc=tboegi@web$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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