2
2
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:
Alexander Neumann 2014-04-21 23:30:00 +02:00
parent 4f3a54dc40
commit 0061207558
2 changed files with 6 additions and 1 deletions

View File

@ -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 {

View File

@ -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)