Skip to content
Snippets Groups Projects
Commit 944a8fa4 authored by Lin Jen-Shin's avatar Lin Jen-Shin :cookie:
Browse files

Use branch_exists? to check branches

parent d03c605b
No related branches found
No related tags found
1 merge request!7237Don't execute git hooks if you create branch as part of other change
......@@ -150,14 +150,14 @@ def check_with_branch_arguments!(
' :source_project is different from current project'
end
unless source_project.repository.commit(source_branch_name).try(:sha)
unless source_project.repository.branch_exists?(source_branch_name)
raise Repository::CommitError.new(
"Cannot find branch #{branch_name} nor" \
" #{source_branch_name} from" \
" #{source_project.path_with_namespace}")
end
elsif source_branch_name
unless repository.commit(source_branch_name).try(:sha)
unless repository.branch_exists?(source_branch_name)
raise Repository::CommitError.new(
"Cannot find branch #{branch_name} nor" \
" #{source_branch_name} from" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment