@@ -149,6 +149,7 @@ func handleExclude(filePath string, excludePattern string) bool {
149149}
150150
151151func handleExcludes (path string , excludes []string ) bool {
152+ // Checks if the path is excluded by any of the given exclude patterns
152153 for _ , excludePattern := range excludes {
153154 matched := handleExclude (path , excludePattern )
154155
@@ -326,9 +327,21 @@ func backupUnit(unit Unit) {
326327
327328 log .Printf ("Creating backup for unit '%s'\n " , unit .name )
328329 var filesToBackup []BackupFileMetadata
330+ var processedSources []string
329331
330332 // Check all source files from the disk in the specified source directories
331333 for _ , sourcePath := range unit .sources {
334+ sourcePath = filepath .Clean (sourcePath )
335+
336+ // Prevent duplicate source paths
337+ for _ , processedPath := range processedSources {
338+ if sourcePath == processedPath {
339+ log .Printf ("Found duplicate source path '%s'. Skipping!" , sourcePath )
340+ continue
341+ }
342+ }
343+ processedSources = append (processedSources , sourcePath )
344+
332345 files , err := getFiles (sourcePath , unit .excludes )
333346 if err != nil {
334347 log .Printf ("Error for unit '%s' while reading directory '%s'! Skipping!" , unit .name , sourcePath )
0 commit comments