Skip to content
  • Linus Torvalds's avatar
    git-rev-list: add option to list all objects (not just commits) · 9de48752
    Linus Torvalds authored
    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.
    9de48752