• Douwe Maan's avatar
    Merge branch 'handle-invalid-kept-around-references' into 'master' · 162f0ba4
    Douwe Maan authored
    Gracefully handle case when keep-around references are corrupted or exist already
    
    We were seeing a number of error messages when attempting to create a keep-around ref:
    
    1. Failed to create locked file `refs/keep-around/XYZ`: File exists
    2. Failed to write reference `refs/keep-around/XYZ`: a reference with that name already exists.
    
    I'm not sure how these happen, but I suspect when multiple workers attempt to write the same file we may have an issue. The force parameter should help ensure the file gets created,
    as well as the rescues to prevent 500 Errors.
    
    Rugged/libgit2 unfortunately does not allow you to delete or re-create a reference that has been corrupted, even with the force parameter. A truncated reference will stay that way until manual intervention.
    
    Closes #20109
    
    See merge request !5430
    Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
    162f0ba4
repository_spec.rb 34.8 KB