Skip to content

Commit f407b92

Browse files
committed
feat: set the locale to en_US.UTF-8 for git commands
1 parent b060e47 commit f407b92

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/git/lib.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,7 @@ def env_overrides
15481548
'GIT_WORK_TREE' => @git_work_dir,
15491549
'GIT_INDEX_FILE' => @git_index_file,
15501550
'GIT_SSH' => Git::Base.config.git_ssh,
1551+
'LC_ALL' => 'en_US.UTF-8'
15511552
}
15521553
end
15531554

tests/units/test_command_line_env_overrides.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class TestCommandLineEnvOverrides < Test::Unit::TestCase
1212
'GIT_DIR' => git.lib.git_dir,
1313
'GIT_INDEX_FILE' => git.lib.git_index_file,
1414
'GIT_SSH' => nil,
15-
'GIT_WORK_TREE' => git.lib.git_work_dir
15+
'GIT_WORK_TREE' => git.lib.git_work_dir,
16+
'LC_ALL' => 'en_US.UTF-8'
1617
}
1718
expected_command_line = [expected_env, 'checkout', {}]
1819

@@ -29,16 +30,15 @@ class TestCommandLineEnvOverrides < Test::Unit::TestCase
2930
Git::Base.config.git_ssh = 'ssh -i /path/to/key'
3031

3132
assert_command_line_eq(expected_command_line_proc, include_env: true) do |git|
32-
# Set the expected command line
33-
3433
expected_env = {
3534
'GIT_DIR' => git.lib.git_dir,
3635
'GIT_INDEX_FILE' => git.lib.git_index_file,
3736
'GIT_SSH' => 'ssh -i /path/to/key',
38-
'GIT_WORK_TREE' => git.lib.git_work_dir
37+
'GIT_WORK_TREE' => git.lib.git_work_dir,
38+
'LC_ALL' => 'en_US.UTF-8'
3939
}
40-
4140
expected_command_line = [expected_env, 'checkout', {}]
41+
4242
git.checkout
4343
end
4444
ensure

0 commit comments

Comments
 (0)