From: Eric Sunshine Date: Fri, 20 Apr 2018 07:08:42 GMT Subject: Re: [PATCH 1/2] commit: fix --short and --porcelain Message-ID: In-Reply-To: <20180418030655.19378-2-sxlijin@gmail.com> On Tue, Apr 17, 2018 at 11:06 PM, Samuel Lijin wrote: > 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 > --- > 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.