File: 0001-Support-different-localized-git-messages.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 (61 lines) | stat: -rw-r--r-- 2,531 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
From: Sascha Girrulat <sascha@girrulat.de>
Date: Wed, 11 Sep 2019 11:20:37 +0200
Subject: Support different localized git messages
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

git2svn sometimes parses the stdout of git commands but if the locale is
not set to something like en_US it can't and fails with the following
error:

Running command: git branch --track "<branch>" "remotes/svn/<branch>"
fatal: No se puede configurar el rastreo de información; el punto de
partida 'remotes/svn/1.0' no es una rama.
********************************************************************
svn2git warning: Tracking remote SVN branches is deprecated.
In a future release local branches will be created without tracking.
If you must resync your branches, run: svn2git --rebase
********************************************************************
Running command: git checkout "<branch>"
error: pathspec '<branch>' did not match any file(s) known to git.
command failed:
...

A comparable error for 'git config' happened if a older version of
git (< 1.7.4) will be used.

It's never a good idea to parse messages from stdout in a special
language but this simple fix parse the messages in the same manner and
should support different languages.
---
 lib/svn2git/migration.rb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb
index 4de8a9e..2c9d041 100755
--- 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 =~ /Cannot setup tracking information/m
+          if status =~ /fatal:.+'#{branch}'.+/
             @cannot_setup_tracking_information = true
             run_command(Svn2Git::Migration.checkout_svn_branch(branch))
           else
@@ -476,7 +476,7 @@ module Svn2Git
       if @git_config_command.nil?
         status = run_command('git config --local --get user.name', false)
 
-        @git_config_command = if status =~ /unknown option/m
+        @git_config_command = if status =~ /error: .+\s.+git config \[.+/m
                                 'git config'
                               else
                                 'git config --local'
@@ -488,4 +488,3 @@ module Svn2Git
 
   end
 end
-