From 2c7c0fc8cfb7bf7e9a9a6b3ff494b61ba2428a4c Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Sat, 10 Mar 2018 16:43:46 -0800 Subject: [PATCH] Fix double-recording of recursively-added dirs Previously, if you added a directory, the directory header would be written once, and then written again during the file walk stage. Change-Id: I111e720e2c449411759fffff7808a0871d06b4ac --- mtar.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mtar.go b/mtar.go index 3be8a52..ecd7056 100644 --- a/mtar.go +++ b/mtar.go @@ -444,7 +444,7 @@ func addRecursive(w *tar.Writer, src, prefix string, opts *FileOpts) { src = strings.TrimRight(src, "/") src = filepath.Clean(src) + "/" filepath.Walk(src, func(p string, info os.FileInfo, err error) error { - if info.IsDir() { + if info.IsDir() && !strings.HasSuffix(p, "/") { p += "/" } if p == src || shouldSkip(skipSrcGlobs, p) { -- 2.45.2