From: Michael J Gruber <git@drmicha.warpmail.net>
To: Paul Richards <paul.richards@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Enumerating all objects in the Git object store
Date: Sat, 27 Mar 2010 14:33:57 +0100 [thread overview]
Message-ID: <4BAE0945.8040406@drmicha.warpmail.net> (raw)
In-Reply-To: <a1138db31003260831q34967f69u9fc8de861f7931b1@mail.gmail.com>
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
prev parent reply other threads:[~2010-03-27 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 15:31 Enumerating all objects in the Git object store Paul Richards
2010-03-26 15:53 ` Johannes Sixt
2010-03-26 16:13 ` Jakub Narebski
2010-03-26 17:25 ` Nicolas Pitre
2010-03-26 20:11 ` Johannes Sixt
2010-03-26 20:24 ` Nicolas Pitre
2010-03-26 21:11 ` Paul Richards
2010-03-27 13:33 ` Michael J Gruber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BAE0945.8040406@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=paul.richards@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.