You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
repo: catch exceptions when iterating through status
When we call the block, an exception or even a call to `break` would cause us to
unwind the stack and skip any resource freeing that we may have. The solution is
to call `rb_protect` which will let us catch the exception and raise whenever we
need to.
Doing this as part of a `git_status_foreach` is unnecessarily awkward so move to
iterating over the status list ourselves and free the entry list as soon as we
notice there was an exception.
For example, this program will consume memory
indefinitely:
require 'rugged'
repo = Rugged::Repository.new ARGV[0]
loop do
repo.status do |file, status_data|
break
end
end
Thanks to Aaron Patterson for discovering this and the original hacky fix.
0 commit comments