@@ -515,25 +515,8 @@ public void storeRenamed(Set<String> renamedFiles, Repository repository, String
515
515
LOGGER .log (Level .FINE , "Storing history for {0} renamed files in repository ''{1}''" ,
516
516
new Object []{renamedFiles .size (), repository .getDirectoryName ()});
517
517
518
- // The directories for the renamed files have to be created before
519
- // the actual files otherwise storeFile() might be racing for
520
- // mkdirs() if there are multiple renamed files from single directory
521
- // handled in parallel.
522
- for (final String file : renamedFiles ) {
523
- File cache ;
524
- try {
525
- cache = getCachedFile (new File (env .getSourceRootPath () + file ));
526
- } catch (ForbiddenSymlinkException ex ) {
527
- LOGGER .log (Level .FINER , ex .getMessage ());
528
- continue ;
529
- }
530
- File dir = cache .getParentFile ();
518
+ createDirectoriesForFiles (renamedFiles );
531
519
532
- if (!dir .isDirectory () && !dir .mkdirs ()) {
533
- LOGGER .log (Level .WARNING ,
534
- "Unable to create cache directory ' {0} '." , dir );
535
- }
536
- }
537
520
final Repository repositoryF = repository ;
538
521
final CountDownLatch latch = new CountDownLatch (renamedFiles .size ());
539
522
AtomicInteger renamedFileHistoryCount = new AtomicInteger ();
@@ -565,6 +548,28 @@ public void storeRenamed(Set<String> renamedFiles, Repository repository, String
565
548
new Object []{renamedFileHistoryCount .intValue (), repository .getDirectoryName ()});
566
549
}
567
550
551
+ private void createDirectoriesForFiles (Set <String > files ) throws HistoryException {
552
+ // The directories for the files have to be created before
553
+ // the actual files otherwise storeFile() might be racing for
554
+ // mkdirs() if there are multiple files from single directory
555
+ // handled in parallel.
556
+ for (final String file : files ) {
557
+ File cache ;
558
+ try {
559
+ cache = getCachedFile (new File (env .getSourceRootPath () + file ));
560
+ } catch (ForbiddenSymlinkException ex ) {
561
+ LOGGER .log (Level .FINER , ex .getMessage ());
562
+ continue ;
563
+ }
564
+ File dir = cache .getParentFile ();
565
+
566
+ if (!dir .isDirectory () && !dir .mkdirs ()) {
567
+ LOGGER .log (Level .WARNING ,
568
+ "Unable to create cache directory ' {0} '." , dir );
569
+ }
570
+ }
571
+ }
572
+
568
573
@ Override
569
574
public History get (File file , Repository repository , boolean withFiles )
570
575
throws HistoryException , ForbiddenSymlinkException {
0 commit comments