git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-update-index.txt: reword possibly confusing example
@ 2018-08-08 20:28 Elijah Newren
  2018-08-08 21:31 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Elijah Newren @ 2018-08-08 20:28 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren

The following phrase could be interpreted multiple ways:
  "To pretend you have a file with mode and sha1 at path"

In particular, I can think of two:
  1. Pretend we have some new file, which happens to have a given mode
     and sha1
  2. Pretend one of the files we are already tracking has a different
     mode and sha1 than what it really does

I think people could easily assume either case while reading, but the
example command provided doesn't actually handle the first case, which
caused some minor frustration to at least one user.  Modify the example
command so that it correctly handles both cases, and re-order the
wording in a way that makes it more likely folks will assume the first
interpretation.  I believe the new example shouldn't pose any obstacles
to those wanting the second interpretation (at worst, they pass an
unnecessary extra flag).

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 Documentation/git-update-index.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 4e8e762e68..a9753e6557 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -245,10 +245,10 @@ USING --CACHEINFO OR --INFO-ONLY
 current working directory.  This is useful for minimum-checkout
 merging.
 
-To pretend you have a file with mode and sha1 at path, say:
+To pretend you have a file at path with mode and sha1, say:
 
 ----------------
-$ git update-index --cacheinfo <mode>,<sha1>,<path>
+$ git update-index --add --cacheinfo <mode>,<sha1>,<path>
 ----------------
 
 `--info-only` is used to register files without placing them in the object
-- 
2.18.0.556.g1604670984


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-update-index.txt: reword possibly confusing example
  2018-08-08 20:28 [PATCH] git-update-index.txt: reword possibly confusing example Elijah Newren
@ 2018-08-08 21:31 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-08-08 21:31 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git

Elijah Newren <newren@gmail.com> writes:

> The following phrase could be interpreted multiple ways:
>   "To pretend you have a file with mode and sha1 at path"
>
> In particular, I can think of two:
>   1. Pretend we have some new file, which happens to have a given mode
>      and sha1
>   2. Pretend one of the files we are already tracking has a different
>      mode and sha1 than what it really does
>
> I think people could easily assume either case while reading, but the
> example command provided doesn't actually handle the first case, which
> caused some minor frustration to at least one user.  Modify the example
> command so that it correctly handles both cases, and re-order the
> wording in a way that makes it more likely folks will assume the first
> interpretation.

I do not think the rephrasing loses those who want to update an
existing path, and is a good one.

> -To pretend you have a file with mode and sha1 at path, say:
> +To pretend you have a file at path with mode and sha1, say:
>  
>  ----------------
> -$ git update-index --cacheinfo <mode>,<sha1>,<path>
> +$ git update-index --add --cacheinfo <mode>,<sha1>,<path>
>  ----------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-08 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 20:28 [PATCH] git-update-index.txt: reword possibly confusing example Elijah Newren
2018-08-08 21:31 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).