Commit 06b17ba8 authored by James Lopez's avatar James Lopez

check git-annex message fix and updated spec

parent 04c690e1
......@@ -213,7 +213,7 @@ module Gitlab
end
commits.each do |commit|
next if commit_from_annex_sync?(commit.id, ref)
next if commit_from_annex_sync?(commit.safe_message)
if status_object = check_commit(commit, git_hook)
return status_object
......@@ -367,12 +367,11 @@ module Gitlab
true
end
def commit_from_annex_sync?(rev, ref)
def commit_from_annex_sync?(commit_message)
return false unless Gitlab.config.gitlab_shell.git_annex_enabled
# Commit present in synced/current_branch, so avoid checking git hooks on this
branch_name = "synced/#{Gitlab::Git::Ref.extract_branch_name(ref)}"
project.repository.branch_names_contains(rev).include? branch_name
# Commit message starting with <git-annex in > so avoid git hooks on this
commit_message.start_with?('git-annex in')
end
end
end
......@@ -327,8 +327,7 @@ describe Gitlab::GitAccess, lib: true do
describe 'git annex enabled, push to master branch' do
before do
allow(Gitlab.config.gitlab_shell).to receive(:git_annex_enabled).and_return(true)
create(:ci_commit, project: project, sha: '570e7b2abdd848b95f2f578043fc23bd6f6fd24d', ref: 'refs/heads/master')
project.repository.add_branch(user, 'synced/master', '570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
allow_any_instance_of(Commit).to receive(:safe_message) { 'git-annex in me@host:~/repo' }
end
it { expect(access.push_access_check(git_annex_master_changes)).to be_allowed }
......
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