Test_SyncDefaultGems: Fail when editor run (#9365)
When something went wrong and git launches editor, and a editor chosen
was terminal-based, a test run unnoticeably hangs.
As we intend editors not to be ran with --no-edit, GIT_EDITOR should be
defaulted to `false` so let Git command fails when it attempts to start a
editor. This allows catching such unintentional behaviour in test suite.
(Note: Prior to Git v2.32.0, git cherry-pick --no-edit doesn't work for
conflict resolution so currently the test hangs when older Git is in use.
39edfd5cbc
i.e. Ubuntu 20.04, Debian Bullseye doesn't satisfy this prerequisite.)
This commit is contained in:
parent
17e1d8ca62
commit
fac2536776
@ -175,13 +175,13 @@ module Test_SyncDefaultGems
|
||||
result = nil
|
||||
out = capture_process_output_to([STDOUT, STDERR]) do
|
||||
Dir.chdir("src") do
|
||||
if editor
|
||||
editor, ENV["GIT_EDITOR"] = ENV["GIT_EDITOR"], editor
|
||||
edit = true
|
||||
end
|
||||
orig_editor = ENV["GIT_EDITOR"]
|
||||
ENV["GIT_EDITOR"] = editor || 'false'
|
||||
edit = true if editor
|
||||
|
||||
result = SyncDefaultGems.sync_default_gems_with_commits(@target, commits, edit: edit)
|
||||
ensure
|
||||
ENV["GIT_EDITOR"] = editor if edit
|
||||
ENV["GIT_EDITOR"] = orig_editor
|
||||
end
|
||||
end
|
||||
assert_equal(success, result, out)
|
||||
|
Loading…
x
Reference in New Issue
Block a user