@@ -13,6 +13,7 @@ import fr.yodamad.svn2git.domain.enumeration.StatusEnum.DONE_WITH_WARNINGS
13
13
import fr.yodamad.svn2git.domain.enumeration.StepEnum
14
14
import fr.yodamad.svn2git.domain.enumeration.StepEnum.*
15
15
import fr.yodamad.svn2git.domain.enumeration.SvnLayout
16
+ import fr.yodamad.svn2git.domain.enumeration.SvnLayout.TAG
16
17
import fr.yodamad.svn2git.functions.*
17
18
import fr.yodamad.svn2git.io.Shell
18
19
import fr.yodamad.svn2git.io.Shell.execCommand
@@ -75,7 +76,7 @@ open class Cleaner(val historyMgr: HistoryManager,
75
76
branchName = branchName.replaceFirst(" origin/" .toRegex(), " " )
76
77
LOG .debug(" Branch $branchName " , branchName)
77
78
// checkout new branchName from existing remote branch
78
- val gitCommand = String .format(" git checkout -b %s %s " , branchName, b)
79
+ val gitCommand = String .format(" git checkout -b \" %s \" \" %s \" " , branchName, b)
79
80
execCommand(workUnit.commandManager, workUnit.directory, gitCommand)
80
81
// listCleanedFilesInSvnLocation
81
82
val cleanedFilesBranch: CleanedFiles = listCleanedFilesInSvnLocation(workUnit, b.replace(" origin" , " branches" ), SvnLayout .BRANCH )
@@ -97,10 +98,10 @@ open class Cleaner(val historyMgr: HistoryManager,
97
98
Consumer { t: String ->
98
99
try {
99
100
// checkout new branch 'tmp_tag' from existing tag
100
- val gitCommand = String .format(" git checkout -b tmp_tag %s " , t)
101
+ val gitCommand = String .format(" git checkout -b tmp_tag \" %s \" " , t)
101
102
execCommand(workUnit.commandManager, workUnit.directory, gitCommand)
102
103
// listCleanedFilesInSvnLocation
103
- val cleanedFilesTag: CleanedFiles = listCleanedFilesInSvnLocation(workUnit, t.replace(" origin" , " tags" ), SvnLayout . TAG )
104
+ val cleanedFilesTag: CleanedFiles = listCleanedFilesInSvnLocation(workUnit, t.replace(" origin" , " tags" ), TAG )
104
105
cleanedFilesMap[t.replace(" origin" , " tags" )] = cleanedFilesTag
105
106
// back to master
106
107
execCommand(workUnit.commandManager, workUnit.directory, checkout())
@@ -293,7 +294,6 @@ open class Cleaner(val historyMgr: HistoryManager,
293
294
open fun cleanForbiddenExtensions (workUnit : WorkUnit ): Boolean {
294
295
var clean = false
295
296
if (! StringUtils .isEmpty(workUnit.migration.forbiddenFileExtensions)) {
296
-
297
297
// needed?
298
298
execCommand(workUnit.commandManager, workUnit.directory, gc())
299
299
@@ -418,15 +418,15 @@ open class Cleaner(val historyMgr: HistoryManager,
418
418
val gitElementsToDelete: MutableList <String > = if (isTags) {
419
419
Files .readAllLines(Paths .get(workUnit.directory, GIT_LIST ))
420
420
.stream()
421
- .map { l: String -> l.trim { it <= ' ' }.replace(" origin/" , " " ) }
421
+ .map { l: String -> l.trim { it <= ' ' }.replace(" origin/" , " " ).decode().encode() }
422
422
.filter { t: String -> t.startsWith(" tags" ) }
423
423
.map { l: String -> l.replace(TAGS , " " ) }
424
424
.filter { l: String -> ! l.equals(workUnit.migration.trunk, ignoreCase = true ) }
425
425
.collect(Collectors .toList())
426
426
} else {
427
427
Files .readAllLines(Paths .get(workUnit.directory, GIT_LIST ))
428
428
.stream()
429
- .map { l: String -> l.trim { it <= ' ' }.replace(" origin/" , " " ) }
429
+ .map { l: String -> l.trim { it <= ' ' }.replace(" origin/" , " " ).decode().encode() }
430
430
.filter { l: String -> ! l.startsWith(TAGS ) }
431
431
.filter { l: String -> ! l.equals(workUnit.migration.trunk, ignoreCase = true ) }
432
432
.collect(Collectors .toList())
@@ -480,12 +480,14 @@ open class Cleaner(val historyMgr: HistoryManager,
480
480
// Remove none git branches
481
481
gitElementsToDelete.forEach(Consumer { line: String ->
482
482
try {
483
- var cleanCmd = String .format(" git branch -d -r origin/%s" , String .format(" %s%s" , if (isTags) TAGS else " " , line))
483
+ var cleanCmd = String .format(" git branch -d -r origin/%s" , String .format(" \" %s%s\" " , if (isTags) TAGS else " " , line))
484
484
execCommand(workUnit.commandManager, workUnit.directory, cleanCmd)
485
485
cleanCmd = if (Shell .isWindows) {
486
486
String .format(" rd /s /q \" .git\\ svn\\ refs\\ remotes\\ origin\\ %s\\\" " , String .format(" %s%s" , if (isTags) " tags\\ " else " " , line))
487
487
} else {
488
- String .format(" rm -rf .git/svn/refs/remotes/origin/%s" , String .format(" %s%s" , if (isTags) TAGS else " " , line))
488
+ // var mutableLine = line
489
+ // if (line.contains("(")) mutableLine = line.escapeParenthesis()
490
+ String .format(" rm -rf .git/svn/refs/remotes/origin/%s" , String .format(" \" %s%s\" " , if (isTags) TAGS else " " , line))
489
491
}
490
492
execCommand(workUnit.commandManager, workUnit.directory, cleanCmd)
491
493
} catch (ex: IOException ) {
0 commit comments