0

I can almost get a depth first ordering with git rev-list --in-commit-order --objects --reverse HEAD which gives me something like

commit A
tree AA
blob A
blob B
commit B
tree BA
...

When I want

blob B
blob A
tree AA
commit A
...

Post processing the list to depth first isn't straight forward because two trees of common ancestry might share the same child like

tree A is parent of tree B and blob A
tree B is parent of blob A
k00b
  • 38
  • 1
  • 5
  • I don't think it is possible. – torek Oct 18 '20 at 14:04
  • With `git rev-list` alone, I doubt it, with an extra script to read and reorder the output, possibly. Could you describe the usage you intend to have of the output ? – LeGEC Oct 18 '20 at 17:49
  • @LeGEC I'm encrypting the object graph so I need to traverse the merkle tree depth first to rebuild it. – k00b Oct 18 '20 at 18:41
  • The problem with reordering the input which I currently do is that if tree A and a descendant tree B share blob A, blob A is listed more adjacent to tree A. I might have to just walk the graph myself. – k00b Oct 18 '20 at 18:53

0 Answers0