threads / discuss / 36883

git rebase --skip stuck in a loop

Subject: git rebase --skip stuck in a loop

## tl;dr

9 messages between Jun 10, 2014 and Jun 16, 2014.

replies: 8people: 4as markdown or json

Phillip Susi· Jun 10, 2014, 18:57 UTC · lore
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm in the middle of a long rebase and have had no trouble with git rebase --skip several times, but now it has become stuck:

psusi@devserv:~/parted.git$ git rebase --skip Auto-merging libparted/arch/linux.c CONFLICT (content): Merge conflict in libparted/arch/linux.c

When you have resolved this problem, run "git rebase --continue". If you prefer to skip this patch, run "git rebase --skip" instead. To check out the original branch and stop rebasing, run "git rebase --abort".

psusi@devserv:~/parted.git$ cat .git/rebase-merge/msgnum 17

Each time I try to skip, it just keeps trying to reapply this one patch.  Any ideas?
git version 1.9.1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTl1UcAAoJEI5FoCIzSKrwwHIH/38Cm19zg+37zgckLiy/3GhN 3Gmil5kX+3KkIHCxlPz3Ti3xCA5baM7tDzFdDIKcx8N/i8oALgWeAWf1Euy9Ww1K 3etIAMKzO463kmV7UbgSbLz5DpYWSaGo9WiYAC7xklhQV94w1Ainx5Lo4kRv1Wfj R9TpQgViFnW2gNJv1zw0qHLXk1/h88LlAQsBaaY6I4f/DOLhAte7rGinkTgZtjmo G/9PUMudQcehG65ITPlNLtoFsM8UHadNMLwJts/B7Yq23XNyRF50IaT8c1A/irSU mfYqdHCho3D4kq+k0u+t0Z0bj6pfvo4b0khLafrYLrWGHC5K+Z3lE63ysJ/Mdj8= =LZ9q -----END PGP SIGNATURE-----

Phillip Susi· Jun 12, 2014, 21:01 UTC · re: Phillip Susi · lore

Re: git rebase --skip stuck in a loop

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
So nobody has any ideas on what to check for or how to debug this?
On 6/10/2014 2:57 PM, Phillip Susi wrote:
Show 19 quoted lines
> I'm in the middle of a long rebase and have had no trouble with
> git rebase --skip several times, but now it has become stuck:
> 
> psusi@devserv:~/parted.git$ git rebase --skip Auto-merging
> libparted/arch/linux.c CONFLICT (content): Merge conflict in
> libparted/arch/linux.c
> 
> When you have resolved this problem, run "git rebase --continue". 
> If you prefer to skip this patch, run "git rebase --skip" instead. 
> To check out the original branch and stop rebasing, run "git
> rebase --abort".
> 
> psusi@devserv:~/parted.git$ cat .git/rebase-merge/msgnum 17
> 
> Each time I try to skip, it just keeps trying to reapply this one 
> patch.  Any ideas?
> 
> git version 1.9.1
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTmhUcAAoJEI5FoCIzSKrwkjgIAKOclhuJPiNoWIEv1dBr4DBC IdwG9hY8lQPCN5Pg8th5CYk3ziX7iZ8+jaHEBaUYX2yehT1deg5WfsxU0uezWphH JyHMRX4kk7l1PW3/v3bEvZ0WYe77s4GB3m9XegjKwEL8xtGi7srEPsHgWB8gnFzE hswUMbq5mw9hoIpYnxEs18F2MOfP6i4J3gTilPrmq+hZCQyZrX/IsV5lR6kDXRES j7b3cr6n2EfUeWxKrwo+tMIBdGAgpMamWlzqM7gMND/YUswv84mD3b9lXjEfjqZf GfBXJSH/z0KLDKycYrDOZlryLEnx///N6STg2WGm0oo7ehAKn6Mtgi1rR5y/aYs= =bUQV -----END PGP SIGNATURE-----

brian m. carlson· Jun 13, 2014, 01:02 UTC · re: Phillip Susi · lore

Re: git rebase --skip stuck in a loop

On Thu, Jun 12, 2014 at 05:01:16PM -0400, Phillip Susi wrote:
> So nobody has any ideas on what to check for or how to debug this?

I'm assuming this works in the general case, because we have tests for it. Do you perhaps have a repository and a set of reproduction steps we could use to try to reproduce this?

If you can get that information, I'm interested in trying to fix it.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Phillip Susi· Jun 13, 2014, 01:16 UTC · re: brian m. carlson · lore

Re: git rebase --skip stuck in a loop

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 06/12/2014 09:02 PM, brian m. carlson wrote:
Show 10 quoted lines
> On Thu, Jun 12, 2014 at 05:01:16PM -0400, Phillip Susi wrote:
>> So nobody has any ideas on what to check for or how to debug
>> this?
> 
> I'm assuming this works in the general case, because we have tests
> for it.  Do you perhaps have a repository and a set of reproduction
> steps we could use to try to reproduce this?
> 
> If you can get that information, I'm interested in trying to fix
> it.

I don't have a set of reproduction steps, but I do still have the repo that is in this stuck state if there is any data you might want me to pull out of it ( .git/rebase-apply? ).

I had spoken to another Ubuntu dev who said that he had this happen to him once too and he just did an abort and tried again and the problem went away, so it seems hard to reproduce, which is why I have preserved the problem to try and analyze it.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCgAGBQJTmlDyAAoJEI5FoCIzSKrwN0IH/R6ny2h1XLv3Rj2Aed6C8xzU +XsiNo6RYG9++Jk3vr705CVnmWx+4lwhr7E6jW9ValdDKEYjamypeQUyqrWSokiH IajIMc4BNowGW7Eg1uRV8KQfb1P+QtmxBMwumOnOYk9zPfA9JcmlPVT6g5LrKy9N 6TMIlCMY1v0WPKZhseYYWHayP8PHF8KqSVuGIAZoPKPQdOQjNAOLW+PPbxiQKCcB PrspPx+hNk4NUUm8156BdJO+xEGQpSYIY384yo0dEfvh3QHB4z/wTv84/9APxEQO rV+67fW1psrFX+GkUolL9WFCBOeZRk3nykYJRravSOuOJKBa9laGAmiJT/EjWYI= =DONL -----END PGP SIGNATURE-----

Jeff King· Jun 13, 2014, 07:34 UTC · re: Phillip Susi · lore

Re: git rebase --skip stuck in a loop

On Thu, Jun 12, 2014 at 09:16:34PM -0400, Phillip Susi wrote:
Show 10 quoted lines
> > I'm assuming this works in the general case, because we have tests
> > for it.  Do you perhaps have a repository and a set of reproduction
> > steps we could use to try to reproduce this?
> > 
> > If you can get that information, I'm interested in trying to fix
> > it.
> 
> I don't have a set of reproduction steps, but I do still have the repo
> that is in this stuck state if there is any data you might want me to
> pull out of it ( .git/rebase-apply? ).
Thanks for saving the stuck state.

If it's possible to share the whole repo, it might be worth seeing (then we can all just run "git rebase --continue" ourselves). If it's too big or is confidential, just tarring up .git/rebase-apply and making it available is probably a good first step.

-Peff
Phillip Susi· Jun 13, 2014, 14:15 UTC · re: Jeff King · lore

Re: git rebase --skip stuck in a loop

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/13/2014 3:34 AM, Jeff King wrote:
Show 6 quoted lines
> Thanks for saving the stuck state.
> 
> If it's possible to share the whole repo, it might be worth seeing
> (then we can all just run "git rebase --continue" ourselves). If
> it's too big or is confidential, just tarring up .git/rebase-apply
> and making it available is probably a good first step.
It's the debian parted repo, so nothing confidential.  Here it is:
https://drive.google.com/file/d/0ByOQJBpP4bDXXy13YlN0aE5Fcnc/edit?usp=sharing
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTmweVAAoJEI5FoCIzSKrwI84H/2Di1d5MeQpcg/I02nF7sd/f gICGclFE8MPuTnKYfpYf4/SbSnB9+Znp+9OhQA0frYIblWHWEnUzwhINrDHvqApK hCsuNGb5iHgy8ohZVGqH8B4ew8x4Ru3pwy9VYV2Wc1Z33curDIohx6qi4LCIrlaB StzWgq3h8hV+3QB5zcD9MfAfdKkz1u5bIMlT9VYofYwctYERVk2DyaAj8eKBGyWo 6dWYuZDoQfO3Hnd/uGqWbdHrPiDoSQqYPbHNWNOnX24w+IKDv2Xe9bcHro+9A+Jg PF+QXo4IS1E7CwevExe7gGKK3KdrD9SMixW7hHAbVVnpDIsvw485EL0xsZfmFJk= =ncor -----END PGP SIGNATURE-----

brian m. carlson· Jun 15, 2014, 22:39 UTC · re: Phillip Susi · lore

Re: git rebase --skip stuck in a loop

On Fri, Jun 13, 2014 at 10:15:49AM -0400, Phillip Susi wrote:
Show 14 quoted lines
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 6/13/2014 3:34 AM, Jeff King wrote:
> > Thanks for saving the stuck state.
> > 
> > If it's possible to share the whole repo, it might be worth seeing
> > (then we can all just run "git rebase --continue" ourselves). If
> > it's too big or is confidential, just tarring up .git/rebase-apply
> > and making it available is probably a good first step.
> 
> It's the debian parted repo, so nothing confidential.  Here it is:
> 
> https://drive.google.com/file/d/0ByOQJBpP4bDXXy13YlN0aE5Fcnc/edit?usp=sharing

Okay. This is actually a fairly straightforward issue. In order to reproduce, you have to use git rebase --merge and two patches in sequence have to cause conflicts. In that case, git rebase --skip will fail to ever update the msgnum value, and it will get caught in a loop.

I should have a patch shortly.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
brian m. carlson· Jun 16, 2014, 00:01 UTC · re: brian m. carlson · lore

[PATCH] rebase--merge: fix --skip with two conflicts in a row

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>
---
 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
-- 
2.0.0
Junio C Hamano· Jun 16, 2014, 20:31 UTC · re: brian m. carlson · lore

Re: [PATCH] rebase--merge: fix --skip with two conflicts in a row

"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 12 quoted lines
> 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.
Show 61 quoted lines
>  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

← back to recent threads