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

Unexpected cat-file --batch-check output

From
Bryan Turner <bturner@atlassian.com>
Date
Oct 25, 2021, 19:02 UTC
Message-ID
<CAGyf7-HFGgkXsA-MXBOdiogDid+=F8jmqw0zxwQoUzha-jc1Hw@mail.gmail.com>

I'm working with some users trying to reconcile an odd mismatch observed in some Git output.

Running an ls-tree for a branch and path, limited to a single pattern within, shows this: /usr/bin/git ls-tree -z refs/heads/develop:path/to/parent – file 100644 blob 4c8d566ed80a1554a059b97f7cd533a55bbd2ea8 file

If we then run cat-file --batch-check, though, we see this: echo 'refs/heads/develop refs/heads/develop:path/to/parent/file' | /usr/bin/git cat-file --batch-check 28a05ce2e3079afcb32e4f1777b42971d7933a91 commit 259 cc10f4b278086325aab2f95df97c807c7c6cd75e commit 330

There's a newline after the branch name, inside the single quotes, followed by the same branch name plus the full path. In this output, it comes back as a commit, though. Both commands were run with refs/heads/develop at the same commit. I've checked for a .gitmodules file and while they _do_ have submodules, they're at different, non-intersecting paths to the one in question here.

I can't share the actual repository (I don't have access to it myself), but I'm hoping someone might have some ideas. I've never seen this sort of mismatch before; for every path in the repositories I do have access to that I've tried this for, the cat-file --batch-check always shows "commit" (or "tag") for the ref, and then "blob" for the ref+path. Submodules were the only thing I could think of, but that doesn't appear to be the case. Could it be a subtree instead? How would I check?

Thanks in advance for any ideas; I appreciate any help. Bryan Turner

Next: Jeff King
Message 1 of 6 in “Unexpected cat-file --batch-check output”
  1. Bryan TurnerOct 25, 2021
  2. Jeff KingOct 25, 2021
  3. Bryan TurnerOct 25, 2021
  4. Bryan TurnerOct 26, 2021
  5. Jeff KingOct 27, 2021
  6. Johannes SixtOct 27, 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.