Re: [PATCH 3/3] make commit --verbose work with --no-status
- From
Jeff King <peff@peff.net>
- Date
- Feb 24, 2014, 08:33 UTC
- Message-ID
- <20140224083312.GB32594@sigill.intra.peff.net>
- In-Reply-To
- <CALUzUxrO-=a5u-NpPVcQdnc2sp9dq3St0PZm=QOWr7oMWDz-Jw@mail.gmail.com>
On Mon, Feb 24, 2014 at 12:24:42PM +0800, Tay Ray Chuan wrote:
Show 21 quoted lines
> > What happens here when there is an alternate status format _and_
> > --verbose is used? If I say "git commit --porcelain" it should imply
> > --dry-run. But "git commit --porcelain --verbose" no longer does so
> > after your patch.
>
> I should have just left the --dry-run inference alone, like this.
>
> -->8--
>
> @@ -1141,7 +1146,12 @@ static int parse_and_validate_options
> if (all && argc > 0)
> die(_("Paths with -a does not make sense."));
>
> - if (status_format != STATUS_FORMAT_DEFAULT)
> + if (verbose && !include_status) {
> + include_status = 1;
> + status_format = STATUS_FORMAT_NONE;
> + } else if (status_format != STATUS_FORMAT_DEFAULT)
> dry_run = 1;
>
> return argc;Hrm, not quite, because the way include_status works is weird. If I turn it off in the config, like this:
git config commit.status false
then asking explicitly for a status format should still dry-run and show it:
git commit --porcelain
IOW, include_status is only respected when we are generating the actual commit. So I think you need something more like:
if (status_format == STATUS_FORMAT_DEFAULT) {
if (verbose && !include_status) {
include_status = 1;
status_format = STATUS_FORMAT_NONE;
}
} else
dry_run = 1;-Peff