Commit 581272f6 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Log update-ref errors in OperationService

parent 83fa3de4
...@@ -152,13 +152,15 @@ module Gitlab ...@@ -152,13 +152,15 @@ module Gitlab
# (and have!) accidentally reset the ref to an earlier state, clobbering # (and have!) accidentally reset the ref to an earlier state, clobbering
# commits. See also https://github.com/libgit2/libgit2/issues/1534. # commits. See also https://github.com/libgit2/libgit2/issues/1534.
command = %W[#{Gitlab.config.git.bin_path} update-ref --stdin -z] command = %W[#{Gitlab.config.git.bin_path} update-ref --stdin -z]
_, status = popen(
output, status = popen(
command, command,
repository.path) do |stdin| repository.path) do |stdin|
stdin.write("update #{ref}\x00#{newrev}\x00#{oldrev}\x00") stdin.write("update #{ref}\x00#{newrev}\x00#{oldrev}\x00")
end end
unless status.zero? unless status.zero?
Gitlab::GitLogger.error("'git update-ref' in #{repository.path}: #{output}")
raise Gitlab::Git::CommitError.new( raise Gitlab::Git::CommitError.new(
"Could not update branch #{Gitlab::Git.branch_name(ref)}." \ "Could not update branch #{Gitlab::Git.branch_name(ref)}." \
" Please refresh and try again.") " Please refresh and try again.")
......
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