From 9dba182e519e187fca8b99e078f68ccb1e17cddc Mon Sep 17 00:00:00 2001 From: TobyLL Date: Thu, 19 Oct 2017 15:48:22 +0100 Subject: [PATCH] Ignore comments (lines starting with #) in the --files-from file --- cmd/restic/cmd_backup.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 191a3037b..04c358b38 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -298,9 +298,14 @@ func readLinesFromFile(filename string) ([]string, error) { scanner := bufio.NewScanner(r) for scanner.Scan() { line := scanner.Text() + // ignore empty lines if line == "" { continue } + // strip comments + if strings.HasPrefix(line, "#") { + continue + } lines = append(lines, line) }