git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
Cc: "Mark Mentovai" <mark@chromium.org>,
	 "Git Development" <git@vger.kernel.org>,
	 "Chandra Pratap" <chandrapratap3519@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] apply: set file mode when --reverse creates a deleted file
Date: Thu, 22 May 2025 16:15:56 -0700	[thread overview]
Message-ID: <xmqqplg01bkj.fsf@gitster.g> (raw)
In-Reply-To: <91c86145-1a78-465e-a08c-2fb727dc5a02@app.fastmail.com> (Kristoffer Haugsbakk's message of "Fri, 23 May 2025 00:24:11 +0200")

"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> On Fri, May 23, 2025, at 00:02, Mark Mentovai wrote:
>> Commit 01aff0a (apply: correctly reverse patch's pre- and post-image
>> mode bits; 2023-12-26) revised reverse_patches() to maintain the desired
>
> The way the commit is referred to is almost like the usual
> and recommended
>
>     git show -s --pretty=reference
>
> But with a semicolon instead of a comma.
>
>> property that when only one of patch::old_mode and patch::new_mode is
>> set, the mode will be carried in old_mode. That property is generally
>> correct, with one notable notable exception: when creating a file, only
>
> s/notable notable/notable/
>
>> new_mode will be set. Since reversing a deletion results in a creation,
>> new_mode must be set in that case.
>>
>> Omitting handling for this case meant that reversing a patch that
>> removed an executable file would not result in the executable permission
>> being set on the re-created file.
>>
>> When git apply --reverse is used, reverse_patches() will now additionaly
>> swap old_mode and new_mode for what's represented in the patch as a file
>> deletion, as it is transformed into a file creation under reversal.
>
> The usual way to refer to code behavior is to talk about the code
> without this patch/commit in the present tense.  I think this is talking
> about how the code behaves with this patch applied/with this commit.
>
> In my opinion it helps the narrative flow since something right-now is
> problematic.  Therefore (see next point) do this and that to fix the
> situation.
>
>> Tests are added that ensure that git apply sets file modes correctly on
>> file creation, both in the normal (forward) and reverse direction.
>> Existing test coverage for file modes focused only on mode changes of
>> existing files, and only in the forward direction.
>
> It’s recommended to describe changes as “do this and that” to the code.
> “Add tests”, not “added tests” or “tests are added” (and the latter here
> seems to use a passive construct that doesn’t feel in line with the
> preceding paragraphs).

Thanks for pointing these out.  

The phrasing convention was chosen not because it is superiour than
others (e.g., as long as we do so consistently, there is no logical
reason why describing the state of the codebase without the patch in
the past tense and the state after in the present tense is inferior
to how we describe the state without the patch in the present
tense), but to have _some_ usable standard way to express what the
status quo looks like, what the perceived problems are, and what is
done to improve the situation.  What you described is what we chose
to use, and it is good for all of us to stick to it.


  reply	other threads:[~2025-05-22 23:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 22:02 [PATCH] apply: set file mode when --reverse creates a deleted file Mark Mentovai
2025-05-22 22:24 ` Kristoffer Haugsbakk
2025-05-22 23:15   ` Junio C Hamano [this message]
2025-05-22 22:58 ` Junio C Hamano
2025-05-22 23:48   ` Mark Mentovai
2025-05-23 14:49     ` Junio C Hamano
2025-05-23 17:21 ` [PATCH v2 0/2] " Mark Mentovai
2025-05-23 17:21   ` [PATCH v2 1/2] t4129: test that git apply warns for unexpected mode changes Mark Mentovai
2025-05-23 23:32     ` Junio C Hamano
2025-05-24  3:10       ` Mark Mentovai
2025-05-23 17:21   ` [PATCH v2 2/2] apply: set file mode when --reverse creates a deleted file Mark Mentovai
2025-05-23 23:44     ` Junio C Hamano
2025-05-24  3:19       ` Mark Mentovai
2025-05-24  3:40   ` [PATCH v3 0/2] " Mark Mentovai
2025-05-24  3:40     ` [PATCH v3 1/2] t4129: test that git apply warns for unexpected mode changes Mark Mentovai
2025-05-24  3:40     ` [PATCH v3 2/2] apply: set file mode when --reverse creates a deleted file Mark Mentovai
2025-05-27 13:56     ` [PATCH v3 0/2] " Junio C Hamano

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=xmqqplg01bkj.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chandrapratap3519@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=mark@chromium.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.
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).