mirror of
https://github.com/restic/restic.git
synced 2024-12-22 07:43:03 +00:00
Use nil storage.ID for empty directories, emit in JSON
This commit is contained in:
parent
4f3a54dc40
commit
0061207558
2 changed files with 6 additions and 1 deletions
|
@ -18,7 +18,7 @@ type Node struct {
|
|||
ModTime time.Time `json:"mtime"`
|
||||
User uint32 `json:"user"`
|
||||
Group uint32 `json:"group"`
|
||||
Content ID `json:"content"`
|
||||
Content ID `json:"content,omitempty"`
|
||||
}
|
||||
|
||||
func NewTree() *Tree {
|
||||
|
|
|
@ -36,6 +36,11 @@ func archive_dir(repo storage.Repository, path string) (storage.ID, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// use nil ID for empty directories
|
||||
if len(entries) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
t := storage.NewTree()
|
||||
for _, e := range entries {
|
||||
node := storage.NodeFromFileInfo(e)
|
||||
|
|
Loading…
Reference in a new issue