Skip to content

Optimize branch lookups and force a repository reload for Repository#find_branch

Stan Hu requested to merge sh-reload-find-branch into master

If git gc runs and Repository has an instance to Rugged::Repository, a bug in libgit2 may cause the instance to return a stale value or a missing branch. This change not only optimizes the branch lookup so we don't have to iterate through every branch, but it also works around the git gc issue by forcing a repository reload every time Repository#find_branch is called.

See: https://github.com/libgit2/libgit2/issues/1534

Closes #15392 (closed), #21470 (closed)

Merge request reports

Loading