From: Junio C Hamano <gitster@pobox.com>
To: "Raymond E. Pasco" <ray@ameretat.dev>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] git-apply.txt: update descriptions of --cached, --index
Date: Thu, 20 Aug 2020 16:57:19 -0700 [thread overview]
Message-ID: <xmqq4kowc1ls.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200820231051.85134-1-ray@ameretat.dev> (Raymond E. Pasco's message of "Thu, 20 Aug 2020 19:10:51 -0400")
"Raymond E. Pasco" <ray@ameretat.dev> writes:
> The blurb for "--cached" says it implies "--index", but in reality
> "--cached" and "--index" are distinct modes with different behavior.
>
> Additionally, the descriptions of "--index" and "--cached" are somewhat
> unclear about what might be modified, and what "--index" looks for to
> determine that the index and working copy "match".
>
> Rewrite the blurbs for both options for clarity and accuracy.
>
> Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
> ---
> How's this for an updated wording?
s/blurbs?/description/
> Documentation/git-apply.txt | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
> index b9aa39000f..91d9a8601c 100644
> --- a/Documentation/git-apply.txt
> +++ b/Documentation/git-apply.txt
> @@ -61,18 +61,18 @@ OPTIONS
> file and detects errors. Turns off "apply".
>
> --index::
> - When `--check` is in effect, or when applying the patch
> - (which is the default when none of the options that
> - disables it is in effect), make sure the patch is
> - applicable to what the current index file records. If
> - the file to be patched in the working tree is not
> - up to date, it is flagged as an error. This flag also
> - causes the index file to be updated.
> + Apply the patch to both the index and the working tree (or
> + merely check that it would apply cleanly to both if `--check` is
> + in effect). Note that `--index` expects index entries and
> + working tree copies for relevant paths to be identical (their
> + contents and metadata such as file mode must match), and will
> + raise an error if they are not, even if the patch would apply
> + cleanly to both the index and the working tree in isolation.
I do not see why we want to stress the last part after ", even if".
The safety mechanism insists on the working tree file and the index
entry to be identical, and the location where in the file the
difference is, is irrelevant, whether it is outside the area the
incoming patch touches, or it overlaps.
I however am OK if your thrust is to stress the fact that the paths
must be up to date. I think we can do so by making that the first
thing readers would read about the option, e.g.
After making sure the paths the patch touches in the working
tree are up to date (i.e. have no modifications relative to
their index entries), apply the patch both to the index
entries and to the working tree files (or see if it applies
cleanly, when `--check` is in effect).
> --cached::
> - Apply a patch without touching the working tree. Instead take the
> - cached data, apply the patch, and store the result in the index
> - without using the working tree. This implies `--index`.
> + Apply the patch to just the index, without touching the working
> + tree. If `--check` is in effect, merely check that it would
> + apply cleanly to the index entry.
This side looks good.
Thanks.
next prev parent reply other threads:[~2020-08-20 23:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 23:10 [PATCH v2] git-apply.txt: update descriptions of --cached, --index Raymond E. Pasco
2020-08-20 23:57 ` Junio C Hamano [this message]
2020-08-21 0:26 ` Raymond E. Pasco
2020-08-21 16:17 ` 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
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=xmqq4kowc1ls.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=phillip.wood@dunelm.org.uk \
--cc=ray@ameretat.dev \
/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).