@@ -366,34 +366,42 @@ public void store(History history, Repository repository)
366366 continue ;
367367 }
368368
369- if (env .hasProjects ()) {
369+ List <HistoryEntry > list = map .get (s );
370+ if (list == null ) {
370371 /*
371- * Problem here is that if the original file was a symlink
372- * it's been already dereferenced by
373- * getPathRelativeToSourceRoot(). We have to solve the only
374- * case which is that the symlink led to the project's root.
375- *
376- * @see
377- * RuntimeEnvironment#getPathRelativeToSourceRoot(java.io.File, int)
372+ * This means that the file has not been added yet. So we
373+ * try to see if we should accept it.
378374 */
379- Project project = Project .getProject (test );
380- File parent = test .equals (new File (env .getSourceRootPath (), project .getPath ()))
381- /* this is a project's root */
382- ? test
383- /* this isn't a project's root */
384- : test .getParentFile ();
385- if (!AcceptHelper .accept (project , parent , test )) {
375+ if (env .hasProjects ()) {
376+ /*
377+ * Problem here is that if the original file was a
378+ * symlink it's been already dereferenced by
379+ * getPathRelativeToSourceRoot(). We have to solve the
380+ * only case which is that the symlink led to the
381+ * project's root.
382+ *
383+ * @see
384+ * RuntimeEnvironment#getPathRelativeToSourceRoot(java.io.File,
385+ * int)
386+ */
387+ Project project = Project .getProject (test );
388+ File parent = test .equals (new File (env .getSourceRootPath (), project .getPath ()))
389+ /* this is a project's root */
390+ ? test
391+ /* this isn't a project's root */
392+ : test .getParentFile ();
393+ if (!AcceptHelper .accept (project , parent , test )) {
394+ continue ;
395+ }
396+ } else if (list == null && !AcceptHelper .accept (null , test .getParentFile (), test )) {
386397 continue ;
387398 }
388- } else if (!AcceptHelper .accept (null , test .getParentFile (), test )) {
389- continue ;
390- }
391399
392- List <HistoryEntry > list = map .get (s );
393- if (list == null ) {
400+ // create a new empty record in the map
394401 list = new ArrayList <>();
395402 map .put (s , list );
396403 }
404+
397405 /*
398406 * We need to do deep copy in order to have different tags
399407 * per each commit.
0 commit comments