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

[PATCH v2] git-apply.txt: update descriptions of --cached, --index

From
Raymond E. Pasco <ray@ameretat.dev>
Date
Aug 20, 2020, 23:10 UTC
Message-ID
<20200820231051.85134-1-ray@ameretat.dev>

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?
 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.
 
 --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.
 
 --intent-to-add::
 	When applying the patch only to the working tree, mark new
-- 
2.28.0.1.gcf60d27c7c
Next: Junio C Hamano
Message 1 of 4 in “git-apply.txt: update descriptions of --cached, --index”
  1. git-apply.txt: update descriptions of --cached, --indexRaymond E. Pasco, Aug 20, 2020
  2. Junio C HamanoAug 20, 2020
  3. Raymond E. PascoAug 21, 2020
  4. Junio C HamanoAug 21, 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.