diff options
author | Stan Hu <stanhu@gmail.com> | 2018-03-30 02:10:43 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-04-06 18:17:07 +0300 |
commit | a18eea8c32381b9514083e796a8504fdfc2c81d9 (patch) | |
tree | 85643264b363a582baf884d2df518450323d13aa /lib/gitlab/git_access.rb | |
parent | 44f4a674e2a87d104f700265d835aba000c589f0 (diff) |
Automatically cleanup stale worktrees and lock files upon a push
git 2.16 will fail badly if there are stale worktrees.
Closes #44115
Diffstat (limited to 'lib/gitlab/git_access.rb')
-rw-r--r-- | lib/gitlab/git_access.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 6a01957184d..01f8b22b2b6 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -238,6 +238,11 @@ module Gitlab end def check_change_access!(changes) + # If there are worktrees with a HEAD pointing to a non-existent object, + # calls to `git rev-list --all` will fail in git 2.15+. This should also + # clear stale lock files. + project.repository.clean_stale_repository_files + changes_list = Gitlab::ChangesList.new(changes) # Iterate over all changes to find if user allowed all of them to be applied |