What is a git commit that has "tree" in the output?

Viewed 119

I have a commit id that our CI system complained about. I did a git show of it and the output looks like the following:

$ git show --quiet 36133babfd594450bd499d82edd6160601c35dcb
tree 36133babfd594450bd499d82edd6160601c35dcb

.gitignore
Makefile.am
Pipfile
README.md
autest.sh
gold_tests/
include/
prepare_proxy_verifier.sh
proxy-verifier-version.txt
test-env-check.sh
tools/
unit_tests/

In my years of using git I've never seen a commit that looks like that. I'm used to git show showing something like this:

$ git show --quiet HEAD
commit 7e0a85e3bdd716e91a6f28748a8e93350a7389b1
Author: Evan Zelkowitz <eze@apache.org>
Date:   Tue Mar 2 09:56:07 2021 -0700

    Add tscontdestroy when transaction is closed and pacing rate is reset (#7572)

Note it says who the committer is, the date, and repeats the commit id. The git show for the former id shows none of this.

If I do any searches on "git show tree" (please pity me, look at that output - what else can I search on?) I do not get any useful information. The "tree" is interpreted as a tree of commits, not as something related to this output.

Can someone who recognizes this output please explain it to me? I'm seeing this in the following open source git repository:

https://github.com/apache/trafficserver


Update

Chris Maes and meagar's answers (and Dev-vruper's comment) gave me enough context to understand what had happened. I originally noticed this issue from the following git fetch failure on our jenkins box:

Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress http://192.168.3.1/mirror/trafficserver.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: Unable to find 36133babfd594450bd499d82edd6160601c35dcb under http://192.168.3.1/mirror/trafficserver.git
Cannot obtain needed tree 36133babfd594450bd499d82edd6160601c35dcb
while processing commit 46ab6ca5b97b2103d7977a0b36f4a7948ddf3e3e.
error: Fetch failed.

Note that while processing commit 46ab6ca5b97b2103d7977a0b36f4a7948ddf3e3e it had trouble getting 36133babfd594450bd499d82edd6160601c35dcb. The former is a commit object and the latter is a "tree" object. It looks like that local repo had somehow been corrupted such that the tree referenced in that commit could not longer be read. Removal of the repo and recloning fixed the issue.

For details about git objects (trees, blobs, commits, etc.), please see the link Dev-vruper referenced: http://git-scm.com/book/en/v2/Git-Internals-Git-Objects

2 Answers

Simple answer: 36133babfd594450bd499d82edd6160601c35dcb is not a commit, but a tree object.

From the git-show documentation:

Shows one or more objects (blobs, trees, tags and commits).

A tree is not a commit, it is a file hierarchy.

A commit contains a tree, plus an author, committer and timestamp, parent, and optionally a signature.

The tree is the complete (tracked) state of the file system at a point in time, but it's the commit that imparts history by linking to one or more previous commits.

Commits and trees are stored in the same content-addressable file system that underpins all of Git, and git show can describe the details of either type of object (plus several more).

You can see which tree a given commit points to with git show --format=raw <commit id>:

$ git show --format=raw ba23d664991381fb34fc931883ecfd8a4dbef2b6 
commit ba23d664991381fb34fc931883ecfd8a4dbef2b6
tree c5b9b6101c76f664f0700253dcaebd55295de10f
parent 5a79dfbe81a8b155e260c6fa6c09f98a448d1cd7
author <redacted>
committer <redacted>

....
Related