rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.83k stars 535 forks source link

Exception when --delete-folders specified with backslash at end of folder name #460

Open andrewpmk opened 2 years ago

andrewpmk commented 2 years ago

I get this error when running: java -jar bfg-1.14.0.jar --delete-folders Power_BI\ .

with a backslash at the end of the folder name. It works fine if you omit the backslash at the end.

Operating system: Windows 10 - Version 10.0.19044 Build 19044

Found 531 objects to protect
Found 9 commit-pointing refs : HEAD, refs/heads/master, refs/remotes/origin/HEAD, ...

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at use.newer.java.Util.invokeMainMethod(Util.java:89)
        at use.newer.java.Util.executeMainProgram(Util.java:28)
        at use.newer.java.Util.checkJavaVersionAndExecuteMainProgram(Util.java:18)
        at use.newer.java.Version8.main(Version8.java:5)
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.util.regex.PatternSyntaxException: No character to escape near index 8
Power_BI\
        ^
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2051)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4935)
        at com.madgag.git.bfg.MemoUtil$$anon$2.apply(memo.scala:60)
        at com.madgag.git.bfg.GitUtil$$anon$1.apply(GitUtil.scala:71)
        at com.madgag.git.bfg.CleaningMapper.replacement(GitUtil.scala:46)
        at com.madgag.git.bfg.CleaningMapper.replacement$(GitUtil.scala:45)
        at com.madgag.git.bfg.GitUtil$$anon$1.replacement(GitUtil.scala:70)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.$anonfun$reportsFor$3(ProtectedObjectDirtReport.scala:45)
        at scala.util.Either.fold(Either.scala:189)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.$anonfun$reportsFor$1(ProtectedObjectDirtReport.scala:45)
        at scala.collection.Iterator$$anon$9.next(Iterator.scala:575)
        at scala.collection.mutable.Growable.addAll(Growable.scala:65)
        at scala.collection.mutable.Growable.addAll$(Growable.scala:60)
        at scala.collection.immutable.SetBuilderImpl.addAll(Set.scala:396)
        at scala.collection.immutable.Set$.from(Set.scala:353)
        at scala.collection.immutable.Set$.from(Set.scala:93)
        at scala.collection.IterableOps.map(Iterable.scala:671)
        at scala.collection.IterableOps.map$(Iterable.scala:671)
        at scala.collection.AbstractIterable.map(Iterable.scala:919)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.reportsFor(ProtectedObjectDirtReport.scala:43)
        at com.madgag.git.bfg.cleaner.CLIReporter.reportProtectedCommitsAndTheirDirt(Reporter.scala:133)
        at com.madgag.git.bfg.cleaner.CLIReporter.reportObjectProtection(Reporter.scala:106)
        at com.madgag.git.bfg.cleaner.RepoRewriter$.rewrite(RepoRewriter.scala:96)
        at com.madgag.git.bfg.cli.Main$.$anonfun$new$1(Main.scala:59)
        at com.madgag.git.bfg.cli.Main$.$anonfun$new$1$adapted(Main.scala:34)
        at scala.Option.map(Option.scala:242)
        at com.madgag.git.bfg.cli.Main$.delayedEndpoint$com$madgag$git$bfg$cli$Main$1(Main.scala:34)
        at com.madgag.git.bfg.cli.Main$delayedInit$body.apply(Main.scala:27)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at scala.Function0.apply$mcV$sp$(Function0.scala:39)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
        at scala.App.$anonfun$main$1(App.scala:76)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
        at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.madgag.git.bfg.cli.Main$.main(Main.scala:27)
        at com.madgag.git.bfg.cli.Main.main(Main.scala)
        ... 8 more
Caused by: java.util.regex.PatternSyntaxException: No character to escape near index 8
Power_BI\
        ^
        at com.madgag.globs.openjdk.Globs.toRegexPattern(Globs.java:68)
        at com.madgag.globs.openjdk.Globs.toUnixRegexPattern(Globs.java:211)
        at com.madgag.textmatching.Glob$.regexFor(TextMatcherType.scala:64)
        at com.madgag.textmatching.TextMatcher.r$lzycompute(TextMatcherType.scala:40)
        at com.madgag.textmatching.TextMatcher.r(TextMatcherType.scala:40)
        at com.madgag.textmatching.TextMatcher.apply(TextMatcherType.scala:42)
        at com.madgag.git.bfg.cli.CLIConfig.$anonfun$folderDeletion$3(CLIConfig.scala:158)
        at com.madgag.git.bfg.cli.CLIConfig.$anonfun$folderDeletion$3$adapted(CLIConfig.scala:158)
        at scala.collection.MapView$FilterKeys.$anonfun$iterator$2(MapView.scala:127)
        at scala.collection.MapView$FilterKeys.$anonfun$iterator$2$adapted(MapView.scala:127)
        at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:472)
        at scala.collection.mutable.Growable.addAll(Growable.scala:64)
        at scala.collection.mutable.Growable.addAll$(Growable.scala:60)
        at scala.collection.immutable.MapBuilderImpl.addAll(Map.scala:692)
        at scala.collection.immutable.Map$.from(Map.scala:643)
        at scala.collection.IterableOnceOps.toMap(IterableOnce.scala:1256)
        at scala.collection.IterableOnceOps.toMap$(IterableOnce.scala:1255)
        at scala.collection.AbstractIterable.toMap(Iterable.scala:919)
        at com.madgag.git.bfg.cli.CLIConfig.$anonfun$folderDeletion$2(CLIConfig.scala:158)
        at scala.Function$.$anonfun$chain$2(Function.scala:23)
        at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
        at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
        at scala.collection.immutable.List.foldLeft(List.scala:79)
        at scala.Function$.$anonfun$chain$1(Function.scala:23)
        at com.madgag.git.bfg.cleaner.ObjectIdCleaner.$anonfun$cleanTree$1(ObjectIdCleaner.scala:126)
        at com.madgag.git.bfg.MemoUtil$$anon$3.load(memo.scala:74)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
        ... 49 more