git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Stephen P. Smith" <ischis2@cox.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] wt-status.c: Set the commitable flag in the collect phase.
Date: Fri, 31 Aug 2018 09:23:47 +0200	[thread overview]
Message-ID: <87a7p3c83g.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180831053921.8083-4-ischis2@cox.net>


On Fri, Aug 31 2018, Stephen P. Smith wrote:

> In an update to fix a bug with "commit --dry-run" it was found that
> the commitable flag was broken.  The update was, at the time,
> accepted as it was better than the previous version.

What update is this? I.e. git.git commit id? See the "or this invocation
of `git show`" part of SubmittingPatches for how to quote it in the
commit message.

> Since the set of the flag had been done in wt_longstatus_print_updated,
> set the flag in wt_status_collect_updated_cb.
>
> Set the commitable flag in wt_status_collect_changes_initial to keep
> from introducing a rebase regression.
>
> Leave the setting of the commitable flag in show_merge_in_progress. If
> a check for merged commits is moved to the collect phase then other
> --dry-run tests fail.
>
> Signed-off-by: Stephen P. Smith <ischis2@cox.net>
> ---
>  wt-status.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/wt-status.c b/wt-status.c
> index 5ffab6101..d50798425 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -540,10 +540,12 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
>  			/* Leave {mode,oid}_head zero for an add. */
>  			d->mode_index = p->two->mode;
>  			oidcpy(&d->oid_index, &p->two->oid);
> +			s->commitable = 1;
>  			break;
>  		case DIFF_STATUS_DELETED:
>  			d->mode_head = p->one->mode;
>  			oidcpy(&d->oid_head, &p->one->oid);
> +			s->commitable = 1;
>  			/* Leave {mode,oid}_index zero for a delete. */
>  			break;
>
> @@ -561,6 +563,7 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
>  			d->mode_index = p->two->mode;
>  			oidcpy(&d->oid_head, &p->one->oid);
>  			oidcpy(&d->oid_index, &p->two->oid);
> +			s->commitable = 1;
>  			break;
>  		case DIFF_STATUS_UNMERGED:
>  			d->stagemask = unmerged_mask(p->two->path);
> @@ -665,11 +668,13 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
>  			 * code will output the stage values directly and not use the
>  			 * values in these fields.
>  			 */
> +			s->commitable = 1;
>  		} else {
>  			d->index_status = DIFF_STATUS_ADDED;
>  			/* Leave {mode,oid}_head zero for adds. */
>  			d->mode_index = ce->ce_mode;
>  			oidcpy(&d->oid_index, &ce->oid);
> +			s->commitable = 1;
>  		}
>  	}
>  }
> @@ -773,7 +778,6 @@ static void wt_longstatus_print_updated(struct wt_status *s)
>  			continue;
>  		if (!shown_header) {
>  			wt_longstatus_print_cached_header(s);
> -			s->commitable = 1;
>  			shown_header = 1;
>  		}
>  		wt_longstatus_print_change_data(s, WT_STATUS_UPDATED, it);

This looks sensible, but I'm not familiar with the status code.

Structurally, re: my comment on 1/3 and 2/3, it would make sense to make
this a two-part series. In 1/2 you add the test you're adding in 2/3 as
a test_expect_failure test, and in 2/2 (this commit) you tweak all the
"test_expect_failure" that now pass to "test_expect_success".

  reply	other threads:[~2018-08-31  7:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31  5:39 [PATCH 0/3] wt-status.c: commitable flag Stephen P. Smith
2018-08-31  5:39 ` [PATCH 1/3] Change tests from expecting to fail to expecting success Stephen P. Smith
2018-08-31  7:17   ` Ævar Arnfjörð Bjarmason
2018-08-31  5:39 ` [PATCH 2/3] Add test for commit --dry-run --short Stephen P. Smith
2018-08-31  7:18   ` Ævar Arnfjörð Bjarmason
2018-08-31 16:26     ` Junio C Hamano
2018-08-31 17:58     ` Stephen & Linda Smith
2018-09-01 11:55   ` SZEDER Gábor
2018-08-31  5:39 ` [PATCH 3/3] wt-status.c: Set the commitable flag in the collect phase Stephen P. Smith
2018-08-31  7:23   ` Ævar Arnfjörð Bjarmason [this message]
2018-08-31 16:54     ` Junio C Hamano
2018-08-31 18:13     ` Stephen & Linda Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7p3c83g.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ischis2@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).