Subject: Re: [PATCH] git-apply.txt: correct description of --cached

From: Junio C Hamano <[email-masked]>
Date: Mon, 10 Aug 2020 09:18:41 -0700

"Raymond E. Pasco" <[email-masked]> writes:

> The blurb for "--cached" says it implies "--index", but in reality
> "--cached" and "--index" are distinct modes with different behavior.
>
> Remove the sentence "This implies `--index`." to make the description
> accurate.
>
> Signed-off-by: Raymond E. Pasco <[email-masked]>
> ---
>  Documentation/git-apply.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
> index b9aa39000f..373a9354b5 100644
> --- a/Documentation/git-apply.txt
> +++ b/Documentation/git-apply.txt
> @@ -72,7 +72,7 @@ OPTIONS
>  --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`.
> +	without using the working tree.

The updated text is not wrong per-se, but I have a feeling that this
is barking up a wrong tree.  The implication is probably referring
to the fact that "--index" does certain verification and "--cached"
does the same (i.e. the patch must be applicable to what is in the
index).  We may want to update the description for both options.

How about simplifying them like this, perhaps?

 Documentation/git-apply.txt | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index b9aa39000f..92b5f0ae22 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -58,21 +58,18 @@ OPTIONS
 --check::
 	Instead of applying the patch, see if the patch is
 	applicable to the current working tree and/or the index
-	file and detects errors.  Turns off "apply".
+	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 contents in the index and in the
+	working tree.  It is an error if the patched file in the
+	working tree is not up to date.
 
 --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 only to the contents in the index but not to
+	the working tree.  It is OK if the contents in the index
+	and in the working tree are different, as the latter is
+	never looked at.
 
 --intent-to-add::
 	When applying the patch only to the working tree, mark new