git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] apply: clarify description of --index

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2020, 14:38 UTC
Message-ID
<xmqqzh4dhurk.fsf@gitster.c.googlers.com>
In-Reply-To
<23806f2c-df96-b105-3b85-f40b0e8ec7ca@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 17 quoted lines
>> -	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.
>> +	After making sure the paths the patch touches in the working
>> +	tree 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.
>
> I don't think that this is an improvement. The purpose of --index *is*
> to apply the patch to both index and worktree, and that should be
> mentioned first. The check that both are identical, is a prerequisite
> and not the primary objective of the option.

Yeah, but this was an attempt to clarify what that "apply to both", which is the central part of the operation, exactly means.

The only mode of operation we offer is that we start from identical index and working tree, and make the same change so that we arrive at the same outcome. It is not like you can have some changes in the working tree file as long as they do not overlap and collide with the incoming patch, make the same change with the patch to arrive at different contents as the outcome. We explicitly forbid that, but "apply to both" does not exactly tell it to the readers.

But I am OK to drop this, if you do not think it clarifies the description.

Thanks.
Previous: Johannes SixtNext: Johannes Sixt
Message 3 of 5 in “apply: clarify description of --index”
  1. apply: clarify description of --indexJunio C Hamano, Oct 23, 2020
  2. Johannes SixtOct 23, 2020
  3. Junio C HamanoOct 23, 2020
  4. Johannes SixtOct 23, 2020
  5. Junio C HamanoOct 23, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.