From: Michael J Gruber Date: Sat, 27 Mar 2010 13:33:57 GMT Subject: Re: Enumerating all objects in the Git object store Message-ID: <4BAE0945.8040406@drmicha.warpmail.net> In-Reply-To: Paul Richards venit, vidit, dixit 26.03.2010 16:31: > Hi, > I'd like to visualize the objects in a Git repository using Graphviz > and "dot". I'd like to see commits as circles, trees as triangles, > blobs as rectangles, and have arrows linking these objects showing how > they reference each other in the Git DAG. For small repositories this > may be a useful way to visualize how Git objects work. > > I could not find a pre-existing script to do this so I am considering > writing one. Is there a way to enumerate all the objects in the Git > object store, and for each one figure out its type (commit, tree, or > blob) and obtain a list of the objects it references? If not, is > there a way to do this for a single object at a time? (I can then > simply recurse through the whole structure.) > If you don't care about loose (unreferenced) objects then it's enough to walk through all refs (branches, tags) and, for each ref, look at parent and tree references (using git cat-file) and recurse. If you don't care about the sha1 of commits you might even want to (ab)use git-fast-export for that! Michael