mirror of
https://github.com/octoleo/restic.git
synced 2024-11-28 15:56:37 +00:00
Use nil storage.ID for empty directories, emit in JSON
This commit is contained in:
parent
4f3a54dc40
commit
0061207558
@ -18,7 +18,7 @@ type Node struct {
|
|||||||
ModTime time.Time `json:"mtime"`
|
ModTime time.Time `json:"mtime"`
|
||||||
User uint32 `json:"user"`
|
User uint32 `json:"user"`
|
||||||
Group uint32 `json:"group"`
|
Group uint32 `json:"group"`
|
||||||
Content ID `json:"content"`
|
Content ID `json:"content,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTree() *Tree {
|
func NewTree() *Tree {
|
||||||
|
@ -36,6 +36,11 @@ func archive_dir(repo storage.Repository, path string) (storage.ID, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use nil ID for empty directories
|
||||||
|
if len(entries) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
t := storage.NewTree()
|
t := storage.NewTree()
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
node := storage.NodeFromFileInfo(e)
|
node := storage.NodeFromFileInfo(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user