git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Edward Thomson <ethomson@edwardthomson.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] add: add --chmod=+x / --chmod=-x options
Date: Wed, 25 May 2016 00:51:42 -0700	[thread overview]
Message-ID: <xmqq1t4q378x.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160525020609.GA20123@zoidberg> (Edward Thomson's message of "Tue, 24 May 2016 21:06:09 -0500")

Edward Thomson <ethomson@edwardthomson.com> writes:

>  	if (trust_executable_bit && has_symlinks)
>  		ce->ce_mode = create_ce_mode(st_mode);
> +	else if (force_executable)
> +		ce->ce_mode = create_ce_mode(0777);
> +	else if (force_notexecutable)
> +		ce->ce_mode = create_ce_mode(0666);
>  	else {
>  		/* If there is an existing entry, pick the mode bits and type
>  		 * from it, otherwise assume unexecutable regular file.

I would rather do this part more like:

	if (S_ISREG(st_mode) && (force_executable || force_nonexecuable)) {
        	if (force_executable)
			ce->ce_mode = create_ce_mode(0777);
		else
			ce->ce_mode = create_ce_mode(0666);
	} else if (trust_executable_bit && has_symlinks) {
        	ce->ce_mode = create_ce_mode(st_mode);
	} else {
        	... carry the existing mode over ...

which would make sure that the new code will not interfere with
symbolic links and that forcing will be honored even on filesystems
whose executable bit can be trusted (i.e. "can be trusted" does not
have to mean "must be trusted").

  parent reply	other threads:[~2016-05-25  7:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  2:06 [PATCH] add: add --chmod=+x / --chmod=-x options Edward Thomson
2016-05-25  7:36 ` Junio C Hamano
2016-05-25 12:19   ` Johannes Schindelin
2016-05-25 16:10     ` Junio C Hamano
2016-05-25 16:49       ` Johannes Schindelin
2016-05-25 16:00   ` Junio C Hamano
2016-05-27  4:41   ` Edward Thomson
2016-05-27  5:12     ` Mike Hommey
2016-05-27  6:36     ` Junio C Hamano
2016-05-27 18:30       ` Junio C Hamano
2016-05-31 22:06         ` Edward Thomson
2016-05-25  7:46 ` Johannes Schindelin
2016-05-27 18:35   ` Junio C Hamano
2016-05-25  7:51 ` Junio C Hamano [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-05-31 22:08 Edward Thomson
2016-05-31 22:34 ` Junio C Hamano
2016-06-01  7:23   ` Johannes Schindelin
2016-06-01 10:19     ` Johannes Schindelin
2016-06-01 16:00     ` Junio C Hamano
2016-06-07 22:59       ` Edward Thomson
2016-06-08  0:39         ` Junio C Hamano
2016-06-08 11:46 ` Duy Nguyen

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqq1t4q378x.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=ethomson@edwardthomson.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).