From 1a0f786e49cda5fcb82f271a16c046072e9b90d4 Mon Sep 17 00:00:00 2001 From: Alexander Maslov Date: Mon, 10 Apr 2017 15:39:50 +0300 Subject: [PATCH] Fix UTF-8 message errors --- lib/git/lib.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 777e42ea..394968ad 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -859,10 +859,14 @@ def meets_required_version? def command_lines(cmd, opts = [], chdir = true, redirect = '') cmd_op = command(cmd, opts, chdir) - op = cmd_op.encode("UTF-8", "binary", { - :invalid => :replace, - :undef => :replace - }) + if cmd_op.encoding.name != "UTF-8" + op = cmd_op.encode("UTF-8", "binary", { + :invalid => :replace, + :undef => :replace + }) + else + op = cmd_op + end op.split("\n") end