graphing commit trees

From: Lennert Buytenhek <hidden>
Date: 2016-06-15 22:41:55

Hi!

As a 5-minute hack to see how easy it'd be to create trees from commit
objects: the attached perl script creates a file suitable for feeding
to dot/dotty from the graphviz suite.  Example graph at:

	http://www.liacs.nl/~buytenh/graph_42d4dc3f4e1ec1396371aac89d0dccfdd977191b.png

Warning: big image (2746x41363), many apps can't display it properly.
(mozilla gives an error, eog shows only the top 32768 pixel rows, gimp
seems to work.)


--L


#!/usr/bin/perl

my %processed;

sub traverse {
        my $commit = shift;
        my $parent;
        my @parents;

        return if (defined $processed{$commit});
        $processed{$commit} = "";

        @parents = split(" ", `git-cat-file commit $commit | grep "^parent " | awk '{print \$2}'`);

        foreach $parent (@parents) {
                print "\"$parent\" -> \"$commit\"\n";
                traverse($parent);
        }
}

sub mk_graph {
        my $root = shift;

        print "digraph blah_$root {\n";
        traverse($root);
        print "}\n";
}

$root = `cat .git/HEAD`;
chomp $root;

mk_graph($root);

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help