From: "Philip Oakley" <philipoakley@iee.org>
To: "Junio C Hamano" <gitster@pobox.com>, <git@vger.kernel.org>
Subject: Re: [PATCH v3 06/18] rerere: drop want_sp parameter from is_cmarker()
Date: Sat, 18 Jul 2015 09:24:04 +0100 [thread overview]
Message-ID: <3AAC96959AB14E61B7711B914D963B7F@PhilipOakley> (raw)
In-Reply-To: 1437171880-21590-7-git-send-email-gitster@pobox.com
From: "Junio C Hamano" <gitster@pobox.com>
> As the nature of the conflict marker line determies if there should
"should be a"?
i.e. s/a /be a / below
> a SP and label after it, the caller shouldn't have to pass the
> parameter redundantly.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> rerere.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/rerere.c b/rerere.c
> index 304df02..4c45f55 100644
> --- a/rerere.c
> +++ b/rerere.c
> @@ -148,8 +148,25 @@ static int rerere_file_getline(struct strbuf *sb,
> struct rerere_io *io_)
> return strbuf_getwholeline(sb, io->input, '\n');
> }
>
> -static int is_cmarker(char *buf, int marker_char, int marker_size,
> int want_sp)
> +/*
> + * Require the exact number of conflict marker letters, no more, no
> + * less, followed by SP or any whitespace
> + * (including LF).
> + */
> +static int is_cmarker(char *buf, int marker_char, int marker_size)
> {
> + int want_sp;
> +
> + /*
> + * The beginning of our version and the end of their version
> + * always are labeled like "<<<<< ours" or ">>>>> theirs",
> + * hence we set want_sp for them. Note that the version from
> + * the common ancestor in diff3-style output is not always
> + * labelled (e.g. "||||| common" is often seen but "|||||"
> + * alone is also valid), so we do not set want_sp.
> + */
> + want_sp = (marker_char == '<') || (marker_char == '>');
> +
> while (marker_size--)
> if (*buf++ != marker_char)
> return 0;
> @@ -172,19 +189,19 @@ static int handle_path(unsigned char *sha1,
> struct rerere_io *io, int marker_siz
> git_SHA1_Init(&ctx);
>
> while (!io->getline(&buf, io)) {
> - if (is_cmarker(buf.buf, '<', marker_size, 1)) {
> + if (is_cmarker(buf.buf, '<', marker_size)) {
> if (hunk != RR_CONTEXT)
> goto bad;
> hunk = RR_SIDE_1;
> - } else if (is_cmarker(buf.buf, '|', marker_size, 0)) {
> + } else if (is_cmarker(buf.buf, '|', marker_size)) {
> if (hunk != RR_SIDE_1)
> goto bad;
> hunk = RR_ORIGINAL;
> - } else if (is_cmarker(buf.buf, '=', marker_size, 0)) {
> + } else if (is_cmarker(buf.buf, '=', marker_size)) {
> if (hunk != RR_SIDE_1 && hunk != RR_ORIGINAL)
> goto bad;
> hunk = RR_SIDE_2;
> - } else if (is_cmarker(buf.buf, '>', marker_size, 1)) {
> + } else if (is_cmarker(buf.buf, '>', marker_size)) {
> if (hunk != RR_SIDE_2)
> goto bad;
> if (strbuf_cmp(&one, &two) > 0)
> --
> 2.5.0-rc2-340-g0cccc16
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-07-18 8:24 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 6:04 [PATCH v2 00/13] "rerere" minor clean-up Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 01/13] rerere: fix an off-by-one non-bug Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 02/13] rerere: plug conflict ID leaks Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 03/13] rerere: lift PATH_MAX limitation Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 04/13] rerere: write out each record of MERGE_RR in one go Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 05/13] rerere: report autoupdated paths only after actually updating them Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 06/13] rerere: drop want_sp parameter from is_cmarker() Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 07/13] rerere: stop looping unnecessarily Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 08/13] rerere: explain the rerere I/O abstraction Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 09/13] rerere: explain MERGE_RR management helpers Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 10/13] rerere: explain the primary codepath Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 11/13] rerere: explain "rerere forget" codepath Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 12/13] rerere: explain the remainder Junio C Hamano
2015-07-01 6:04 ` [PATCH v2 13/13] rerere: refactor "replay" part of do_plain_rerere() Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 00/18] "rerere" preparatory clean-up Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 01/18] rerere: fix an off-by-one non-bug Junio C Hamano
2015-07-24 19:46 ` Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 02/18] rerere: plug conflict ID leaks Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 03/18] rerere: lift PATH_MAX limitation Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 04/18] rerere: write out each record of MERGE_RR in one go Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 05/18] rerere: report autoupdated paths only after actually updating them Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 06/18] rerere: drop want_sp parameter from is_cmarker() Junio C Hamano
2015-07-18 8:24 ` Philip Oakley [this message]
2015-07-18 8:47 ` Eric Sunshine
2015-07-17 22:24 ` [PATCH v3 07/18] rerere: stop looping unnecessarily Junio C Hamano
2015-07-24 20:06 ` Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 08/18] rerere: explain the rerere I/O abstraction Junio C Hamano
2015-07-24 20:42 ` Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 09/18] rerere: explain MERGE_RR management helpers Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 10/18] rerere: explain the primary codepath Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 11/18] rerere: explain "rerere forget" codepath Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 12/18] rerere: explain the remainder Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 13/18] rerere: refactor "replay" part of do_plain_rerere() Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 14/18] rerere: further de-dent do_plain_rerere() Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 15/18] rerere: further clarify do_rerere_one_path() Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 16/18] rerere: call conflict-ids IDs Junio C Hamano
2015-07-17 22:24 ` [PATCH v3 17/18] rerere: use "struct rerere_id" instead of "char *" for conflict ID Junio C Hamano
2015-07-18 8:47 ` Eric Sunshine
2015-07-17 22:24 ` [PATCH v3 18/18] rerere: un-nest merge() further Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3AAC96959AB14E61B7711B914D963B7F@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).