You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2020/03/05 21:51:27 UTC
[mynewt-newt] 02/02: Fix skipping the copy of empty dirs on tree
copies
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit 34d7d90344552a47d81d62cc2a354c3752263caa
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Thu Mar 5 08:53:18 2020 -0300
Fix skipping the copy of empty dirs on tree copies
The CopyDir implementation did not copy empty directories which was
resulting in a dirty repo after the tree copy with non-cloned submodules
(empty dirs) was performed.
The issue resulted from calling `MkdirAll` with the parent directory of
the current directory under copy, followed by a `ReadDir` which would
result in an empty list of files/dirs, skipping the directory creation
(by skipping the recursive tree copy).
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
util/util.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/util.go b/util/util.go
index ac92c28..91e8aed 100644
--- a/util/util.go
+++ b/util/util.go
@@ -525,7 +525,7 @@ func CopyDir(srcDirStr, dstDirStr string) error {
return ChildNewtError(err)
}
- if err := os.MkdirAll(filepath.Dir(dstDirStr), info.Mode()); err != nil {
+ if err := os.MkdirAll(dstDirStr, info.Mode()); err != nil {
return ChildNewtError(err)
}