avoid quoting spaces in git-annex find output to terminal

That's too much quoting, the user expects the filename to be copy and
pasteable. It would be ok to slash-escape space ('\ ')
which is what gnu find does, but it doesn't seem necessary either.

${escaped_file} has always quoted spaces though, so keep on doing it
there.

Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
Joey Hess 2023-04-26 00:12:38 -04:00
parent 4358545a3e
commit 4d6c918eff
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 6 additions and 6 deletions

View file

@ -10,7 +10,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
control characters are only filtered out when displaying to the control characters are only filtered out when displaying to the
terminal. terminal.
* find, findkeys, examinekey: When outputting to a terminal and --format * find, findkeys, examinekey: When outputting to a terminal and --format
is not used, quote unusual characters. is not used, quote control characters. Output to a pipe is unchanged.
(Similar to the behavior of GNU find.) (Similar to the behavior of GNU find.)
* addurl --preserve-filename now rejects filenames that contain other * addurl --preserve-filename now rejects filenames that contain other
control characters, besides the escape sequences it already rejected. control characters, besides the escape sequences it already rejected.

View file

@ -105,7 +105,7 @@ showFormatted (IsTerminal isterminal) format unformatted vars =
case format of case format of
Nothing -> do Nothing -> do
liftIO $ S8.putStrLn $ if isterminal liftIO $ S8.putStrLn $ if isterminal
then Utility.Format.escapedFormat unformatted then Utility.Format.encode_c (const False) unformatted
else unformatted else unformatted
Just formatter -> liftIO $ putStr $ Just formatter -> liftIO $ putStr $
Utility.Format.format formatter $ Utility.Format.format formatter $

View file

@ -35,7 +35,7 @@ that can be determined purely by looking at the key.
Also, '\\n' is a newline, '\\000' is a NULL, etc. Also, '\\n' is a newline, '\\000' is a NULL, etc.
The default output format is the same as `--format='${escapedkey}\\n'` The default output format is the same as `--format='${escapedkey}\\n'`
when outputting to the terminal, and otherwise `--format='${key}\\n'` except when outputting to a terminal, control characters will be escaped.
* `--json` * `--json`

View file

@ -50,8 +50,8 @@ finds files in the current directory and its subdirectories.
Also, '\\n' is a newline, '\\000' is a NULL, etc. Also, '\\n' is a newline, '\\000' is a NULL, etc.
The default output format is the same as `--format='${escaped_file}\\n'` The default output format is the same as `--format='${file}\\n'`,
when outputting to the terminal, and otherwise `--format='${file}\\n'` except when outputting to a terminal, control characters will be escaped.
* `--json` * `--json`

View file

@ -46,7 +46,7 @@ Outputs a list of keys known to git-annex.
Also, '\\n' is a newline, '\\000' is a NULL, etc. Also, '\\n' is a newline, '\\000' is a NULL, etc.
The default output format is the same as `--format='${escapedkey}\\n'` The default output format is the same as `--format='${escapedkey}\\n'`
when outputting to the terminal, and otherwise `--format='${key}\\n'` except when outputting to a terminal, control characters will be escaped.
* `--json` * `--json`