Skip to content

Commit

Permalink
Ignore empty lines in excludes file
Browse files Browse the repository at this point in the history
Closes #915
  • Loading branch information
fd0 committed Apr 16, 2017
1 parent 525db87 commit c796d84
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/cmds/restic/cmd_backup.go
Expand Up @@ -415,11 +415,20 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {

scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
if !strings.HasPrefix(line, "#") {
line = os.ExpandEnv(line)
opts.Excludes = append(opts.Excludes, line)
line := strings.TrimSpace(scanner.Text())

// ignore empty lines
if line == "" {
continue
}

// strip comments
if strings.HasPrefix(line, "#") {
continue
}

line = os.ExpandEnv(line)
opts.Excludes = append(opts.Excludes, line)
}
}

Expand Down

0 comments on commit c796d84

Please sign in to comment.