File: 0002-Use-global-stdin-instead-of-local-variable.patch

package info (click to toggle)
svn2git 2.4.0-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: ruby: 406; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 2,104 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Sascha Girrulat <sascha@girrulat.de>
Date: Wed, 11 Sep 2019 13:32:50 +0200
Subject: Use global stdin instead of local variable

The stdin bypass will use a local variable stdin instead of $stdin and
it will result in the following error:

Traceback (most recent call last):
	2: from /usr/lib/ruby/vendor_ruby/svn2git/migration.rb:432:in `block (2 levels) in run_command'
      	1: from /usr/lib/ruby/vendor_ruby/svn2git/migration.rb:432:in `loop'
/usr/lib/ruby/vendor_ruby/svn2git/migration.rb:438:in `block (3 levels) in run_command': undefined local variable or method `stdin' for #<Svn2Git::Migration:0x0000555b7c945cc8> (NameError)
Did you mean?  String

This fix should handle the error and uses the global stdin
---
 lib/svn2git/migration.rb | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/lib/svn2git/migration.rb
+++ b/lib/svn2git/migration.rb
@@ -357,7 +357,7 @@ module Svn2Git
           # Our --rebase option obviates the need for read-only tracked remotes, however.  So, we'll
           # deprecate the old option, informing those relying on the old behavior that they should
           # use the newer --rebase otion.
-          if status =~ /fatal:.+'#{branch}'.+/
+          if status =~ /fatal:.+remotes\/svn\/#{branch}'.+/
             @cannot_setup_tracking_information = true
             run_command(Svn2Git::Migration.checkout_svn_branch(branch))
           else
@@ -430,13 +430,17 @@ module Svn2Git
         # sub-process's stdin pipe.
         Thread.new do
           loop do
-            user_reply = @stdin_queue.pop
+            begin
+              user_reply = @stdin_queue.pop
 
-            # nil is our cue to stop looping (pun intended).
-            break if user_reply.nil?
+              # nil is our cue to stop looping (pun intended).
+              break if user_reply.nil?
 
-            stdin.puts user_reply
-            stdin.close
+              $stdin.puts user_reply
+              $stdin.close
+            rescue IOError
+              $stdout.print "No input requested.\n"
+            end
           end
         end