git-apply.txt: update descriptions of --cached, --index
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Raymond E. Pasco committed
Aug 20, 2020 at 19:10 UTC
d064702be39d974d0eee403f4fbae92f8f0534a7
1 file changed
+10
-10
Documentation/git-apply.txt
+10
-10
@@ -61,18 +61,18 @@ OPTIONS
61
file and detects errors. Turns off "apply".
62
63
--index::
64
- When `--check` is in effect, or when applying the patch
65
- (which is the default when none of the options that
66
- disables it is in effect), make sure the patch is
67
- applicable to what the current index file records. If
68
- the file to be patched in the working tree is not
69
- up to date, it is flagged as an error. This flag also
70
- causes the index file to be updated.
64
+ Apply the patch to both the index and the working tree (or
65
+ merely check that it would apply cleanly to both if `--check` is
66
+ in effect). Note that `--index` expects index entries and
67
+ working tree copies for relevant paths to be identical (their
68
+ contents and metadata such as file mode must match), and will
69
+ raise an error if they are not, even if the patch would apply
70
+ cleanly to both the index and the working tree in isolation.
71
72
--cached::
73
- Apply a patch without touching the working tree. Instead take the
74
- cached data, apply the patch, and store the result in the index
75
- without using the working tree. This implies `--index`.
73
+ Apply the patch to just the index, without touching the working
74
+ tree. If `--check` is in effect, merely check that it would
75
+ apply cleanly to the index entry.
76
77
--intent-to-add::
78
When applying the patch only to the working tree, mark new