fetching of Git changesets sometimes fails due to non existant revisions in prev_db_heads
Under certain circumstances it may happen that revisions disappear from a git repository (i.e. when the repository is compacted / garbage collected after doing force pushes).
Redmine stores a
prev_db_heads list in the repositories
extra_info, which may contain hashes pointing to such no more existing objects. In this case,
Repository#fetch_changesets will fail silently and not fetch anything, since the underlying
git log command refuses to work when non existing revisions are given on the command line.
The attached patch was extracted from Planio and checks each entry in
prev_db_heads, keeping only those that still exist.
Updated by Go MAEDA over 7 years ago
- Target version deleted (
Candidate for next minor release)
Thanks for the patch. But a test fails in my environment.
$ ruby test/unit/repository_git_test.rb (snip) # Running: ..............F........... Finished in 12.697746s, 2.0476 runs/s, 13.6245 assertions/s. 1) Failure: RepositoryGitTest#test_fetch_changesets_history_editing [test/unit/repository_git_test.rb:241]: Expected: 23 Actual: 29 26 runs, 173 assertions, 1 failures, 0 errors, 0 skips