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

[PATCH] git-update-index.txt: reword possibly confusing example

From
Elijah Newren <newren@gmail.com>
Date
Aug 8, 2018, 20:28 UTC
Message-ID
<20180808202807.15350-1-newren@gmail.com>
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
Next: Junio C Hamano
Message 1 of 2 in “git-update-index.txt: reword possibly confusing example”
  1. git-update-index.txt: reword possibly confusing exampleElijah Newren, Aug 8, 2018
  2. Junio C HamanoAug 8, 2018

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.