From 964439907411540672c908fd20aa6dcfb5982ee9 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sat, 16 Apr 2016 22:04:29 +0200 Subject: [PATCH 1/2] add environment-var expanding for exclude-files --- src/cmds/restic/cmd_backup.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index 11275d00a..b32e7af59 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -6,15 +6,15 @@ import ( "fmt" "os" "path/filepath" - "strings" - "time" - - "golang.org/x/crypto/ssh/terminal" "restic" "restic/backend" "restic/debug" "restic/filter" "restic/repository" + "strings" + "time" + + "golang.org/x/crypto/ssh/terminal" ) type CmdBackup struct { @@ -313,6 +313,7 @@ func (cmd CmdBackup) Execute(args []string) error { for scanner.Scan() { line := scanner.Text() if !strings.HasPrefix(line, "#") { + line = os.ExpandEnv(line) cmd.Excludes = append(cmd.Excludes, line) } } From 4fb6669196d63a6d81f126f82a096b12e97d99da Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sat, 16 Apr 2016 22:07:36 +0200 Subject: [PATCH 2/2] add documentation for environment-var expanding in exclude-files --- doc/Manual.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/Manual.md b/doc/Manual.md index a16d74a00..7d431937e 100644 --- a/doc/Manual.md +++ b/doc/Manual.md @@ -179,7 +179,8 @@ Either specify them with multiple `--exclude`'s or one `--exclude-file` Patterns use [`filepath.Glob`](https://golang.org/pkg/path/filepath/#Glob) internally, see [`filepath.Match`](https://golang.org/pkg/path/filepath/#Match) for syntax. -Additionally `**` exludes arbitrary subdirectories. +Additionally `**` exludes arbitrary subdirectories. +Environment-variables in exclude-files are expanded with [`os.ExpandEnv`](https://golang.org/pkg/os/#ExpandEnv). # List all snapshots