git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] archive: Refuse to write the archive to a terminal.

From
RDReece Dunn <msclrhd@googlemail.com>
Date
Sep 16, 2009, 11:48 UTC
Message-ID
<3f4fd2640909160448x1fbb7a64s1ce0adca2af5010@mail.gmail.com>
In-Reply-To
<237967ef0909160427m4d7de120tf5ef3176f75123ad@mail.gmail.com>
2009/9/16 Mikael Magnusson <mikachu@gmail.com>:
Show 9 quoted lines
> 2009/9/16 Johannes Sixt <j.sixt@viscovery.net>:
>> Josh Triplett schrieb:
>>> I considered adding a -f/--force option, like gzip has, but writing an
>>> archive to a tty seems like a sufficiently insane use case that I'll let
>>> whoever actually needs that write the patch for it. ;)
>>
>> How about '--output -' instead?
>
> You could always just add '|cat'.

Except when running on Windows. Yes MSYS and cygwin provide a version of cat, but this cannot be guaranteed (e.g. with the series to support building with MSVC).

The `--output -` / `-o -` syntax looks reasonable (the issue with using -f/--force is: what are you forcing the operation of?). Is - used elsewhere in git for specifying stdout?

Also, the die message might be more useful (and in keeping with the other git commands) by showing the 'inline context help'; something like:

    Failed to generate the archive: output is a terminal.
    Please specify the file to write to (using `-o archive.tar`) or
redirect the output (e.g. `... | gzip`).
    If you want to write the archive out to the terminal, use `-o -`
to force the operation.
- Reece
Previous: Mikael MagnussonNext: Matthieu Moy
Message 4 of 7 in “archive: Refuse to write the archive to a terminal.”
  1. archive: Refuse to write the archive to a terminal.Josh Triplett, Sep 16, 2009
  2. Johannes SixtSep 16, 2009
  3. Mikael MagnussonSep 16, 2009
  4. Reece DunnSep 16, 2009
  5. Matthieu MoySep 16, 2009
  6. Josh TriplettSep 17, 2009
  7. Johannes SixtSep 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.