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

Re: git read-tree doesn't accept tree-ish

From
Elijah Newren <newren@gmail.com>
Date
Aug 23, 2021, 17:38 UTC
Message-ID
<CABPp-BE7JMdWi5DzHkkkZiM-7u1pW3uhwh1W69yEOxaGuAmUbw@mail.gmail.com>
In-Reply-To
<CAMJzOtxMjEuAy2B3oJqOZEnipmC4OBWxhQLx_baXDHcQ1C7-+g@mail.gmail.com>
On Mon, Aug 23, 2021 at 10:32 AM Nikita Bobko <nikitabobko@gmail.com> wrote:
Show 18 quoted lines
>
> ```
> git init
> echo foo > foo
> git add --all
> git commit -m 'foo'
>
> echo bar > foo
> git add --all
> git commit -m 'bar'
>
> git read-tree HEAD~:foo
> ```
> EXP: Read information about file `foo` into index
> ACT: `fatal: failed to unpack tree object HEAD~:foo`
>
> I expect it to work because manpage says that `git-read-tree` accepts
> `<tree-ish>`

HEAD~:foo is not a tree in your example, it's a blob. Try running this: `git cat-file -t HEAD~:foo`, to see the type.

Previous: Nikita BobkoNext: Jeff King
Message 2 of 7 in “git read-tree doesn't accept tree-ish”
  1. Nikita BobkoAug 23, 2021
  2. Elijah NewrenAug 23, 2021
  3. Jeff KingAug 23, 2021
  4. Nikita BobkoAug 23, 2021
  5. Elijah NewrenAug 23, 2021
  6. Junio C HamanoAug 23, 2021
  7. Nikita BobkoAug 23, 2021

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.