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

[PATCH 3/3] hash-object doc: point to ls-files and rev-parse

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 20, 2019, 21:53 UTC
Message-ID
<20190520215312.10363-4-avarab@gmail.com>
In-Reply-To
<20190520215312.10363-1-avarab@gmail.com>

Amend the intro to note that it's better to ask the index about files already tracked by it.

I've seen uses of this in the wild where the use-case was finding object IDs for files found in a freshly cloned repo, i.e. something like "git ls-files | git hash-object --stdin-paths".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/git-hash-object.txt | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt
index 100630d021..077d83ec65 100644
--- a/Documentation/git-hash-object.txt
+++ b/Documentation/git-hash-object.txt
@@ -20,6 +20,13 @@ work tree), and optionally writes the resulting object into the
 object database.  Reports its object ID to its standard output.
 When <type> is not specified, it defaults to "blob".
 
+This command won't take the shortcut of seeing if the path(s) to be
+hashed are present in the index, in which case their already computed
+object ID could be retrieved by linkgit:git-ls-files[1] via the
+`--stage` option, or by linkgit:git-rev-parse[1]. Use those instead of
+e.g. `--stdin-paths` if the intent is to say find the blob object IDs
+of checked-out files.
+
 OPTIONS
 -------
 
-- 
2.21.0.1020.gf2820cf01a
Previous: Junio C HamanoNext: Jeff King
Message 11 of 12 in “hash-object doc: small fixes”
  1. 0/3 hash-object doc: small fixesÆvar Arnfjörð Bjarmason, May 20, 2019
  2. 1/3 hash-object doc: stop mentioning git-cvsimportÆvar Arnfjörð Bjarmason, May 20, 2019
  3. Jeff KingMay 22, 2019
  4. 2/3 hash-object doc: elaborate on -w and --literally promisesÆvar Arnfjörð Bjarmason, May 20, 2019
  5. Jeff KingMay 22, 2019
  6. Jakub NarebskiMay 24, 2019
  7. Ævar Arnfjörð BjarmasonMay 24, 2019
  8. Jeff KingMay 28, 2019
  9. Junio C HamanoMay 28, 2019
  10. Junio C HamanoMay 28, 2019
  11. 3/3 hash-object doc: point to ls-files and rev-parseÆvar Arnfjörð Bjarmason, May 20, 2019
  12. Jeff KingMay 22, 2019

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.