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

[PATCH] apply: clarify description of --index

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2020, 03:49 UTC
Message-ID
<xmqqzh4dk3ey.fsf@gitster.c.googlers.com>

Instead of explaining the requirement for the paths to be up-to-date, as if it is an afterthought, state it upfront.

The updated description matches how the checks actually are performed. A path that is "dirty" stops the patch application from being attempted to either working tree files or to the index.

Hopefully this change would help users to form a better mental model.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * Just noticed while reviewing how "apply" (and "am") are explained.
 Documentation/git-apply.txt | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index 91d9a8601c..1be7751f58 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -61,13 +61,11 @@ OPTIONS
 	file and detects errors.  Turns off "apply".
 
 --index::
-	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.
 
 --cached::
 	Apply the patch to just the index, without touching the working
-- 
2.28.0-462-gf84ddd074d
Next: Johannes Sixt
Message 1 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.