git-annex/doc/git-annex-info.mdwn
Joey Hess ce1b3a9699
info: Allow using matching options in more situations
File matching options like --include will be rejected in situations where
there is no filename to match against. (Or where there is a filename but
it's not relative to the cwd, or otherwise seemed too bothersome to match
against.)

The addition of listKeys' was necessary to avoid using more memory in the
common case of "git-annex info". Adding a filterM would have caused the
list to buffer in memory and not stream. This is an ugly hack, but listKeys
had previously run Annex operations inside unafeInterleaveIO (for direct
mode). And matching against a matcher should hopefully not change any Annex
state.

This does allow for eg `git-annex info somefile --include=*.ext`
although why someone would want to do that I don't really know. But it
seems to make sense to allow it.
But, consider: `git-annex info ./somefile --include=somefile`
This does not match, so will not display info about somefile.
If the user really wants to, they can `--include=./somefile`.

Using matching options like --copies or --in=remote seems likely to be
slower than git-annex find with those options, because unlike such
commands, info does not have optimised streaming through the matcher.

Note that `git-annex info remote` is not the same as
`git-annex info --in remote`. The former shows info about all files in
the remote. The latter shows local keys that are also in that remote.
The output should make that clear, but this still seems like a point
where users could get confused.

Sponsored-by: Jochen Bartl on Patreon
2022-02-21 14:46:07 -04:00

71 lines
1.6 KiB
Markdown

# NAME
git-annex info - information about an item or the repository
# SYNOPSIS
git annex info `[directory|file|treeish|remote|description|uuid ...]`
# DESCRIPTION
Displays statistics and other information for the specified item,
which can be a directory, or a file, or a treeish, or a remote,
or the description or uuid of a repository.
When no item is specified, displays statistics and information
for the local repository and all annexed content.
# OPTIONS
* `--fast`
Only show the data that can be gathered quickly.
* `--json`
Enable JSON output. This is intended to be parsed by programs that use
git-annex. Each line of output is a JSON object.
* `--json-error-messages`
Messages that would normally be output to standard error are included in
the json instead.
* `--bytes`
Show file sizes in bytes, disabling the default nicer units.
* `--batch`
Enable batch mode, in which a line containing an item is read from stdin,
the information about it is output to stdout, and repeat.
* `-z`
Makes the `--batch` input be delimited by nulls instead of the usual
newlines.
* matching options
The [[git-annex-matching-options]](1) can be used to select what
to include in the statistics.
* Also the [[git-annex-common-options]](1) can be used.
# EXAMPLES
Suppose you want to run "git annex get .", but
would first like to see how much disk space that will use.
Then run:
git annex info --fast . --not --in here
# SEE ALSO
[[git-annex]](1)
# AUTHOR
Joey Hess <id@joeyh.name>
Warning: Automatically converted into a man page by mdwn2man. Edit with care.