Skip to content

Commit

Permalink
Merge pull request #497 from Thor77/excludeFileExpandEnv
Browse files Browse the repository at this point in the history
Expand environment-variables in exclude-files
  • Loading branch information
fd0 committed Apr 18, 2016
2 parents 59ec393 + 4fb6669 commit 4531456
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion doc/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions src/cmds/restic/cmd_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 4531456

Please sign in to comment.