Re: `git bundle create -` may not write to `stdout`
- From
Jeff King <peff@peff.net>
- Date
- Mar 4, 2023, 01:46 UTC
- Message-ID
- <ZAKi8MzGWk5PZUJk@coredump.intra.peff.net>
- In-Reply-To
- <ZAKexHiit5vOmv7M@coredump.intra.peff.net>
On Fri, Mar 03, 2023 at 08:28:36PM -0500, Jeff King wrote:
Show 23 quoted lines
> > Given that the other three subcommands also take <file>
> >
> > 'git bundle' create [-q | --quiet | --progress | --all-progress] ...
> > [--version=<version>] <file> <git-rev-list-args>
> > 'git bundle' verify [-q | --quiet] <file>
> > 'git bundle' list-heads <file> [<refname>...]
> > 'git bundle' unbundle [--progress] <file> [<refname>...]
> >
> > but read_bundle_header() function all three calls begins like so:
> >
> > int read_bundle_header(const char *path, struct bundle_header *header)
> > {
> > int fd = open(path, O_RDONLY);
> >
> > if (fd < 0)
> > return error(_("could not open '%s'"), path);
> > return read_bundle_header_fd(fd, header, path);
> > }
> >
> > this function needs to be fixed first ;-)
>
> I wasn't thinking of changing the behavior for input, but just focusing
> the docs in the right spot (the "create" option), like:Oh, hmph. I didn't realize that both my patch and yours are touching a shared options-parser that affects both reading and writing. So the patch by itself is fixing "git bundle create -" but breaking "git bundle verify -". We either need to teach the reading side to handle "-", or we have to teach parse_options_cmd_bundle() to handle the two cases differently.
-Peff