diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2020-02-26 16:11:16 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2020-02-26 16:11:16 +0300 |
commit | e69a628712134cd2874e6bff9bd60001d2b1e374 (patch) | |
tree | 678445f0ff984db0e8b3dd3744acacfecad2ff07 | |
parent | 2cff3b0d40323dbd8f73088f80b7ce2de9b82dd1 (diff) | |
parent | 9620867934ef46f8de50d7a9355ef5167fc64891 (diff) |
Merge branch 'rs-fix-push-results' into 'master'
Fix expected porcelain output for PushResults
See merge request gitlab-org/gitaly!1862
-rw-r--r-- | ruby/lib/gitlab/git/push_results.rb | 5 | ||||
-rw-r--r-- | ruby/spec/lib/gitlab/git/push_results_spec.rb | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/ruby/lib/gitlab/git/push_results.rb b/ruby/lib/gitlab/git/push_results.rb index 6f18fa751..87ab3c145 100644 --- a/ruby/lib/gitlab/git/push_results.rb +++ b/ruby/lib/gitlab/git/push_results.rb @@ -11,13 +11,14 @@ module Gitlab # <flag> \t <from>:<to> \t <summary> (<reason>) # # See https://git-scm.com/docs/git-push#_output + # and https://github.com/git/git/blob/v2.25.1/transport.c#L466-L475 @all = raw_output.each_line.map do |line| line.chomp! - fields = line.split(" \t ", 3) + fields = line.split("\t", 3) # Sanity check for porcelain output - next unless fields.size >= 3 + next unless fields.size == 3 flag = fields.shift next unless Result.valid_flag?(flag) diff --git a/ruby/spec/lib/gitlab/git/push_results_spec.rb b/ruby/spec/lib/gitlab/git/push_results_spec.rb index 438172180..4a14123b4 100644 --- a/ruby/spec/lib/gitlab/git/push_results_spec.rb +++ b/ruby/spec/lib/gitlab/git/push_results_spec.rb @@ -6,13 +6,13 @@ describe Gitlab::Git::PushResults do it 'parses porcelain output' do output = <<~OUTPUT To gitlab.com:gitlab-org/security/gitlab-foss.git - = \t refs/heads/12-5-stable:refs/heads/12-5-stable \t [up to date] - = \t refs/heads/12-6-stable:refs/heads/12-6-stable \t [up to date] - * \t refs/heads/rs-some-new-branch:refs/heads/rs-some-new-branch \t [new branch] - \t refs/heads/rs-fast-forward:refs/heads/rs-fast-forward \t [fast-forward] - - \t refs/heads/rs-deleted:refs/heads/rs-deleted \t [deleted] - + \t refs/heads/rs-forced:refs/heads/rs-forced \t [forced] - ! \t refs/heads/12-7-stable:refs/heads/12-7-stable \t [rejected] (fetch first) + =\trefs/heads/12-5-stable:refs/heads/12-5-stable\t[up to date] + =\trefs/heads/12-6-stable:refs/heads/12-6-stable\t[up to date] + *\trefs/heads/rs-some-new-branch:refs/heads/rs-some-new-branch\t[new branch] + \trefs/heads/rs-fast-forward:refs/heads/rs-fast-forward\t[fast-forward] + -\trefs/heads/rs-deleted:refs/heads/rs-deleted\t[deleted] + +\trefs/heads/rs-forced:refs/heads/rs-forced\t[forced] + !\trefs/heads/12-7-stable:refs/heads/12-7-stable\t[rejected] (fetch first) Done error: failed to push some refs to 'git@gitlab.com:gitlab-org/security/gitlab-foss.git' hint: Updates were rejected because the remote contains work that you do |