Gittyup icon indicating copy to clipboard operation
Gittyup copied to clipboard

Commit::description is sometimes painfully slow in large repositories

Open AHSauge opened this issue 5 months ago • 0 comments

Opening up the Unreal Engine source code in Gittyup reveals a flaw in Commit::description. It's goal is to essentially find the closest tag and either return the tag name or tag +N. The problem is that the implementation is very naive and does a breadth first search without any limitations. If there is a large distance between the commit and the tag, or there's no tag in the branch at all (happens if main is branched into release branches before tagging), then essentially close to the entire repo could at worst be scanned before a result is returned. That's not great for performance.

Given that the git CLI itself is able to provide something similar within a few seconds, I'd say there's a better approach to this than the current implementation. In terms of libgit2, this might mean using git_describe_commit, but using the result from that is a bit tricky since the definition is made private. (Yay for gate-kept data fields!)

AHSauge avatar Aug 10 '25 22:08 AHSauge