Skip to content

feat(ls): list entries with type and metadata with - #1952

Open
AlphaJack wants to merge 1 commit into
rustic-rs:mainfrom
AlphaJack:feat/ls-json-long
Open

AlphaJack wants to merge 1 commit into
rustic-rs:mainfrom
AlphaJack:feat/ls-json-long

Conversation

@AlphaJack

Copy link
Copy Markdown

Fixes #1951

--long no longer conflicts with --json. With both, each entry is an object with its path, the node's type and its metadata, using the same field names as the nodes of cat tree:

[
{"path":"data/dir","type":"dir","mode":2147484141,"mtime":"2026-10-15T22:48:28.543472128+02:00","atime":"…","ctime":"…","uid":1000,"gid":1000,"user":"jack","group":"jack","inode":11408871},
{"path":"data/dir/file.txt","type":"file","mode":420,"mtime":"2026-10-15T22:48:28.543472128+02:00","atime":"…","ctime":"…","uid":1000,"gid":1000,"user":"jack","group":"jack","inode":11408872,"size":6,"links":1}
]
  • --json alone is unchanged (an array of paths), so existing users aren't affected.
  • Times are RFC 3339 with their offset.
  • name (it's in path), content (the data blob ids, one per chunk, large for big files) and subtree are left out.
  • mode is the raw value as stored, like in cat tree; for directories it includes the directory bit.
  • Directories that rustic creates above the backup path have no metadata, so they only have type and mode.

Tests

test_ls_json_long_has_metadata (in tests/backup_restore.rs) backs up, runs ls --json --long latest and checks that every entry has a path and a type, and every file an mtime and a size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls --json lists paths only, and --json --long is refused

1 participant