On Sun, Dec 29, 2019 at 01:12:46AM -0500, Jeff King wrote: > Yeah, I expected that would cover it, too. But instrumenting it to dump > the position of each commit (see patch below), and then decorating "git > log" output with the positions (see script below) shows that we're all > over the map: I forgot the patch, of course. :) I just dumped this trace: --- diff --git a/commit-graph.c b/commit-graph.c index a6c4ab401e..1cb77be45f 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -61,6 +61,7 @@ static void set_commit_pos(struct repository *r, const struct object_id *oid) if (!commit) return; /* should never happen, but be lenient */ + trace_printf("pos %s = %d", oid_to_hex(oid), max_pos); *commit_pos_at(&commit_pos, commit) = max_pos++; } with: rm -f .git/objects/info/commit-graph GIT_TRACE=$PWD/trace.out git commit-graph write --changed-paths --reachable and then used: cat >foo.pl <<\EOF #!/usr/bin/perl my %deco = do { open(my $fh, '<', 'trace.out'); map { /pos (\S+) = (\d+)/ ? ($1 => $2) : () } <$fh> }; while (<>) { s/([0-9a-f]{40})/$deco{$1}/; print; } EOF like so: git log --graph --format=%H | perl foo.pl | less -Peff