git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, Phillip Susi <psusi@ubuntu.com>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH] rebase--merge: fix --skip with two conflicts in a row
Date: Mon, 16 Jun 2014 13:31:59 -0700	[thread overview]
Message-ID: <xmqqoaxsppds.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <ea5a46c7605a181b6726093e04bc882b013fd504.1402876855.git.sandals@crustytoothpaste.net> (brian m. carlson's message of "Mon, 16 Jun 2014 00:01:25 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> If git rebase --merge encountered a conflict, --skip would not work if the
> next commit also conflicted.  The msgnum file would never be updated with
> the new patch number, so no patch would actually be skipped, resulting in an
> inescapable loop.
>
> Update the msgnum file's value as the first thing in call_merge.  This also
> avoids an "Already applied" message when skipping a commit.  There is no
> visible change for the other contexts in which call_merge is invoked, as the
> msgnum file's value remains unchanged in those situations.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---

Sounds good to me.  Thanks.

>  git-rebase--merge.sh    |  5 +++--
>  t/t3402-rebase-merge.sh | 15 +++++++++++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
> index 6d77b3c..d3fb67d 100644
> --- a/git-rebase--merge.sh
> +++ b/git-rebase--merge.sh
> @@ -53,11 +53,12 @@ continue_merge () {
>  }
>  
>  call_merge () {
> -	cmt="$(cat "$state_dir/cmt.$1")"
> +	msgnum="$1"
> +	echo "$msgnum" >"$state_dir/msgnum"
> +	cmt="$(cat "$state_dir/cmt.$msgnum")"
>  	echo "$cmt" > "$state_dir/current"
>  	hd=$(git rev-parse --verify HEAD)
>  	cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)
> -	msgnum=$(cat "$state_dir/msgnum")
>  	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
>  	eval GITHEAD_$hd='$onto_name'
>  	export GITHEAD_$cmt GITHEAD_$hd
> diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
> index be8c1d5..5a27ec9 100755
> --- a/t/t3402-rebase-merge.sh
> +++ b/t/t3402-rebase-merge.sh
> @@ -33,6 +33,7 @@ test_expect_success setup '
>  	tr "[a-z]" "[A-Z]" <original >newfile &&
>  	git add newfile &&
>  	git commit -a -m"side edits further." &&
> +	git branch second-side &&
>  
>  	tr "[a-m]" "[A-M]" <original >newfile &&
>  	rm -f original &&
> @@ -41,6 +42,7 @@ test_expect_success setup '
>  	git branch test-rebase side &&
>  	git branch test-rebase-pick side &&
>  	git branch test-reference-pick side &&
> +	git branch test-conflicts side &&
>  	git checkout -b test-merge side
>  '
>  
> @@ -138,4 +140,17 @@ test_expect_success 'rebase -s funny -Xopt' '
>  	test -f funny.was.run
>  '
>  
> +test_expect_success 'rebase --skip works with two conflicts in a row' '
> +	git checkout second-side  &&
> +	tr "[A-Z]" "[a-z]" <newfile >tmp &&
> +	mv tmp newfile &&
> +	git commit -a -m"edit conflicting with side" &&
> +	tr "[d-f]" "[D-F]" <newfile >tmp &&
> +	mv tmp newfile &&
> +	git commit -a -m"another edit conflicting with side" &&
> +	test_must_fail git rebase --merge test-conflicts &&
> +	test_must_fail git rebase --skip &&
> +	git rebase --skip
> +'
> +
>  test_done

      reply	other threads:[~2014-06-16 20:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 18:57 git rebase --skip stuck in a loop Phillip Susi
2014-06-12 21:01 ` Phillip Susi
2014-06-13  1:02   ` brian m. carlson
2014-06-13  1:16     ` Phillip Susi
2014-06-13  7:34       ` Jeff King
2014-06-13 14:15         ` Phillip Susi
2014-06-15 22:39           ` brian m. carlson
2014-06-16  0:01             ` [PATCH] rebase--merge: fix --skip with two conflicts in a row brian m. carlson
2014-06-16 20:31               ` Junio C Hamano [this message]

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=xmqqoaxsppds.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=psusi@ubuntu.com \
    --cc=sandals@crustytoothpaste.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.
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).