Re: [PATCH 1/2] commit: fix --short and --porcelain
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 20, 2018, 07:08 UTC
- Message-ID
- <CAPig+cQp8c8v5cfaWqPNajcTdxYEj-FrOHykjOi+RAbEa4-VzQ@mail.gmail.com>
- In-Reply-To
- <20180418030655.19378-2-sxlijin@gmail.com>
On Tue, Apr 17, 2018 at 11:06 PM, Samuel Lijin <sxlijin@gmail.com> wrote:
Show 24 quoted lines
> Make invoking `git commit` with `--short` or `--porcelain` return status
> code zero when there is something to commit.
>
> Mark the commitable flag in the wt_status object in the call to
> `wt_status_collect()`, instead of in `wt_longstatus_print_updated()`,
> and simplify the logic in the latter function to take advantage of the
> logic shifted to the former.
>
> Signed-off-by: Samuel Lijin <sxlijin@gmail.com>
> ---
> diff --git a/wt-status.c b/wt-status.c
> @@ -754,26 +770,25 @@ static void wt_longstatus_print_unmerged(struct wt_status *s)
> static void wt_longstatus_print_updated(struct wt_status *s)
> {
> - int shown_header = 0;
> - int i;
> + if (!s->commitable) {
> + return;
> + }
> +
> + wt_longstatus_print_cached_header(s);
>
> + int i;
> for (i = 0; i < s->change.nr; i++) {Declaration after statement: Declare 'i' at the top of the function as it was before this patch.