Browse Source

Archive: Fix up tar commandline arguments in TarFilter()

There is no need to duplicate the compression flags for
every element in the filter.
Alexander Larsson 11 years ago
parent
commit
b86f67126c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      archive.go

+ 2 - 1
archive.go

@@ -90,8 +90,9 @@ func TarFilter(path string, compression Compression, filter []string) (io.Reader
 	if filter == nil {
 	if filter == nil {
 		filter = []string{"."}
 		filter = []string{"."}
 	}
 	}
+	args = append(args, "-c"+compression.Flag())
 	for _, f := range filter {
 	for _, f := range filter {
-		args = append(args, "-c"+compression.Flag(), f)
+		args = append(args, f)
 	}
 	}
 	return CmdStream(exec.Command(args[0], args[1:]...))
 	return CmdStream(exec.Command(args[0], args[1:]...))
 }
 }