Skip to content

Commit b6f1b45

Browse files
committed
Fixed bug with running on Windows via JRuby
1 parent c47ccb6 commit b6f1b45

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/git/lib.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,10 @@ def run_command(git_cmd, &block)
10771077
end
10781078

10791079
def escape(s)
1080-
return "'#{s && s.to_s.gsub('\'','\'"\'"\'')}'" if RUBY_PLATFORM !~ /mingw|mswin/
1080+
# Check if on Windows via RUBY_PLATFORM (CRuby) and RUBY_DESCRIPTION (JRuby)
1081+
win_platform_regex = /mingw|mswin/
1082+
return "'#{s && s.to_s.gsub('\'','\'"\'"\'')}'" if RUBY_PLATFORM !~ win_platform_regex && RUBY_DESCRIPTION !~ win_platform_regex
1083+
10811084

10821085
# Keeping the old escape format for windows users
10831086
escaped = s.to_s.gsub('\'', '\'\\\'\'')

0 commit comments

Comments
 (0)