Commit f35cfe59 authored by Marin Jankovski's avatar Marin Jankovski

If git-annex is enabled and it does its require branch sync, skip git_hooks.

parent ce8d0a4f
......@@ -85,6 +85,8 @@ module Gitlab
end
def push_access_check(changes)
return build_status_object(true) if git_annex_branch_sync?(changes)
if user
user_push_access_check(changes)
elsif deploy_key
......@@ -325,5 +327,23 @@ module Gitlab
build_status_object(false, "You don't have permission")
end
end
def git_annex_branch_sync?(changes)
return false unless Gitlab.config.gitlab_shell.git_annex_enabled
return false if changes.blank?
changes = changes.lines if changes.kind_of?(String)
# Iterate over all changes to find if user allowed all of them to be applied
# 0000000000000000000000000000000000000000 3073696294ddd52e9e6b6fc3f429109cac24626f refs/heads/synced/git-annex
# 0000000000000000000000000000000000000000 65be9df0e995d36977e6d76fc5801b7145ce19c9 refs/heads/synced/master
changes.map(&:strip).reject(&:blank?).each do |change|
unless change.end_with?("refs/heads/synced/git-annex") || change.include?("refs/heads/synced/")
return false
end
end
true
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment