Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include inode in JSON output for find and ls #4511

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

dnnr
Copy link
Contributor

@dnnr dnnr commented Oct 11, 2023

What does this PR change? What problem does it solve?

This introduces the inode attribute to the JSON output emitted for nodes in ls and matches in find. There doesn't seem to be any discernible reason to omit the inode and it can be useful in scripting scenarios.

Was the change previously discussed in an issue or on the forum?

There was a brief discussion in the IRC channel.

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

This introduces the inode attribute to the JSON output emitted for nodes
in `ls` and matches in `find`. There doesn't seem to be any discernible
reason to omit the inode and it can be useful in scripting scenarios.
@dnnr
Copy link
Contributor Author

dnnr commented Oct 11, 2023

I'm not entirely sure if I should add any tests for this. Many of the existing attributes currently don't seem to be tested either. cmd_ls_test.go appears to cover some special cases but there's no basic case that just confirms the full list of possible fields. Should I add something like that, or would you consider it rather pointless/superfluous as it just reiterates the implementation?

Copy link
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Ideally, we'd extract the restic.Node to JSON conversion into a separate method (using the approach from cmd_ls.go) and add a very basic test just to make sure that the JSON output doesn't change unexpectedly. But that's out of scope for this PR.

@MichaelEischer MichaelEischer added this pull request to the merge queue Oct 17, 2023
Merged via the queue into restic:master with commit 4959822 Oct 17, 2023
12 checks passed
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.

None yet

2 participants