Skip to content

Commit b3d8ccb

Browse files
committed
sync_default_gems: patch for focal/bullseye git
ruby/ruby#9365
1 parent b54c2e4 commit b3d8ccb

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From: Sorah Fukumori <[email protected]>
2+
Date: Wed, 27 Dec 2023 06:07:57 +0900
3+
Subject: Test_SyncDefaultGems: Fail when editor run
4+
5+
When something went wrong and git launches editor, and a editor chosen
6+
was terminal-based, a test run unnoticeably hangs.
7+
8+
As we intend editors not to be run with --no-edit, GIT_EDITOR should be
9+
defaulted to `false` so let Git command fails when it attempts to start a
10+
editor. This allows catching such unintentional behaviour in test suite.
11+
12+
(Note: Prior to Git v2.32.0, git cherry-pick doesn't support --no-edit.
13+
https://github.com/git/git/commit/39edfd5cbc4d168db19ec1bc867d78ec7211ec39 )
14+
---
15+
tool/test/test_sync_default_gems.rb | 10 +++++-----
16+
1 file changed, 5 insertions(+), 5 deletions(-)
17+
18+
diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb
19+
index 3bf87b3..e64c6c6 100755
20+
--- a/tool/test/test_sync_default_gems.rb
21+
+++ b/tool/test/test_sync_default_gems.rb
22+
@@ -175,13 +175,13 @@ module Test_SyncDefaultGems
23+
result = nil
24+
out = capture_process_output_to([STDOUT, STDERR]) do
25+
Dir.chdir("src") do
26+
- if editor
27+
- editor, ENV["GIT_EDITOR"] = ENV["GIT_EDITOR"], editor
28+
- edit = true
29+
- end
30+
+ orig_editor = ENV["GIT_EDITOR"]
31+
+ ENV["GIT_EDITOR"] = editor || 'false'
32+
+ edit = true if editor
33+
+
34+
result = SyncDefaultGems.sync_default_gems_with_commits(@target, commits, edit: edit)
35+
ensure
36+
- ENV["GIT_EDITOR"] = editor if edit
37+
+ ENV["GIT_EDITOR"] = orig_editor
38+
end
39+
end
40+
assert_equal(success, result, out)

debian/patches/series

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ exclude-several-tests-unstable-in-Docker.patch
66
Fix-FTBFS-on-x32-misdetected-as-i386-or-amd64.patch
77
TestProcess-disable-gems-to-disable-rubygems_integration.patch
88
extract-gems-sequential-Keep-using-RUNRUBY.patch
9+
Test_SyncDefaultGems-Fail-when-editor-run.patch
10+
sync_default_gems-git-2.32-ignores-no-edit-in-cherry-pick.patch
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From: Sorah Fukumori <[email protected]>
2+
Date: Wed, 27 Dec 2023 06:25:02 +0900
3+
Subject: sync_default_gems: git <2.32 ignores --no-edit in cherry-pick
4+
5+
https://github.com/git/git/commit/39edfd5cbc4d168db19ec1bc867d78ec7211ec39
6+
---
7+
tool/sync_default_gems.rb | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
11+
index f4774ba..8151751 100755
12+
--- a/tool/sync_default_gems.rb
13+
+++ b/tool/sync_default_gems.rb
14+
@@ -651,7 +651,7 @@ module SyncDefaultGems
15+
if picked
16+
system(*%w"git commit --amend --no-edit")
17+
else
18+
- system(*%w"git cherry-pick --continue --no-edit")
19+
+ system({'GIT_EDITOR' => 'true'}, *%w"git cherry-pick --continue")
20+
end or return nil
21+
22+
# Amend the commit if RDoc references need to be replaced

0 commit comments

Comments
 (0)