Uncommon Uncommon - 1 year ago 88
Git Question

git_revwalk ignores order of pushed refs?

In using

(through Objective-Git's
), I'm trying to get more recently updated branches ordered first. I'm calling
with refs sorted by commit date, but it has no effect. Sorted, reverse sorted, and unsorted all come out the same.

comes close, but I do need a topological ordering, so I'm setting both flags.

Is there a way to get
to use the refs in the order I give them?

Answer Source

libgit2 would often not provide quite the same topological sorting as git, since there are multiple possible topological sortings which are all correct.

A recent PR ported over more code from git to make the output more consistent for other reasons, so you make use of that. Specifying both a topological and time-based sort (GIT_SORT_TOPOLOGICAL | GIT_SORT_TIME), equivalent to git rev-list's --date-order will sort the tips you requested by time with the current master.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download