]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/rev-list.c
git-rev-list: add option to list all objects (not just commits)
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 25 Jun 2005 05:56:58 +0000 (22:56 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 25 Jun 2005 05:56:58 +0000 (22:56 -0700)
commit9de48752fedc4923502c522af0e1f5b94c5fea2e
tree5fa9dc8ce4813f3433c65d14da5b99ae899e9119
parent023d66ed7b397c811a0693f34851d8590b69247b
git-rev-list: add option to list all objects (not just commits)

When you do

git-rev-list --objects $(git-rev-parse HEAD^..HEAD)

it now lists not only the "commit difference" between the parent of HEAD
and HEAD itself (which is normally just the parent, but in the case of a
merge will be all the newly merged commits), but also all the new tree
and blob objects that weren't in the original.

NOTE! It doesn't walk all the way to the root, so it doesn't do a full
object search in the full old history.  Instead, it will only look as
far back in the history as it needs to resolve the commits.  Thus, if
the commit reverts a blob (or tree) back to a state much further back in
history, we may end up listing some blobs (or trees) as "new" even
though they exist further back.

Regardless, the list of objects will be a superset (usually exact) list
of objects needed to go from the beginning commit to ending commit.

As a particularly obvious special case,

git-rev-list --objects HEAD

will end up listing every single object that is reachable from the HEAD
commit.

Side note: the objects are sorted by "recency", with commits first.
rev-list.c