From 5e75d377059a78f7bb13d954fa3c1cb4ed653766 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 1 May 2018 10:44:39 +0200 Subject: [PATCH] Use Ruby methods, not Rails' String#first Gitaly-Ruby is not a Rails application, which made the method not exist after the vendor. This patch uses direct indexing, which has the same properties that `#first` has. Found while working on: https://gitlab.com/gitlab-org/gitaly/merge_requests/699 --- lib/gitlab/git/raw_diff_change.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/git/raw_diff_change.rb b/lib/gitlab/git/raw_diff_change.rb index eb3d8819239..92f6c45ce25 100644 --- a/lib/gitlab/git/raw_diff_change.rb +++ b/lib/gitlab/git/raw_diff_change.rb @@ -38,7 +38,9 @@ module Gitlab end def extract_operation - case @raw_operation&.first(1) + return :unknown unless @raw_operation + + case @raw_operation[0] when 'A' :added when 'C'