summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-09-05 10:48:06 +0000
committerDouwe Maan <douwe@gitlab.com>2016-09-05 10:48:06 +0000
commitae1da08f25e6253c1d58ac24214a63572bf533db (patch)
treeada9567479dc93c1f494930bc0d9b68fe053ab54 /lib
parentb46c703b841c78a8c7616d320fc3e85ed645fab1 (diff)
parentffef94f17e16a9ca9f0c1d1b970f2354d5144357 (diff)
downloadgitlab-ce-ae1da08f25e6253c1d58ac24214a63572bf533db.tar.gz
Merge branch 'safe-ref-updates' into 'master'
Safer ref updates Use `git update-ref` to prevent clobbering concurrent ref updates. If rugged/libgit2 is temporarily confused, due to concurrent `git gc` for example, then it used to be possible to accidentally reset a ref to an earlier state and lose commits. Because `git update-ref` does not get confused by `git gc`, what will happen now is that the commit based on confused information fails, preventing data loss. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/20353 See merge request !6130
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/popen.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index ca23ccef25b..a0fd41161a5 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -21,9 +21,9 @@ module Gitlab
@cmd_output = ""
@cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
- # We are not using stdin so we should close it, in case the command we
- # are running waits for input.
+ yield(stdin) if block_given?
stdin.close
+
@cmd_output << stdout.read
@cmd_output << stderr.read
@cmd_status = wait_thr.value.exitstatus