All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rebase -i continue: Don't skip submodule only commits
@ 2012-04-07 10:20 John Keeping
  2012-04-09 22:09 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: John Keeping @ 2012-04-07 10:20 UTC (permalink / raw)
  To: git; +Cc: John Keeping, Jens Lehmann

When git-rebase--interactive stops due to a conflict and the only change
to be committed is in a submodule, the test for whether there is
anything to be committed ignores the staged submodule change.  This
leads rebase to skip creating the commit for the change.

While unstaged submodule changes should be ignored to avoid needing to
update submodules during a rebase, it is safe to remove the
--ignore-submodules option to diff-index because --cached ensures that
it is only checking the index.  This was discussed in [1] and a test is
included to ensure that unstaged changes are still ignored correctly.

[1] http://thread.gmane.org/gmane.comp.version-control.git/188713

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 git-rebase--interactive.sh    |    2 +-
 t/t3404-rebase-interactive.sh |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 5812222..4546749 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -672,7 +672,7 @@ rearrange_squash () {
 case "$action" in
 continue)
 	# do we have anything to commit?
-	if git diff-index --cached --quiet --ignore-submodules HEAD --
+	if git diff-index --cached --quiet HEAD --
 	then
 		: Nothing to commit -- skip this
 	else
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b981572..7fd2127 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -624,8 +624,38 @@ test_expect_success 'submodule rebase -i' '
 	FAKE_LINES="1 squash 2 3" git rebase -i A
 '
 
+test_expect_success 'submodule conflict setup' '
+	git tag submodule-base &&
+	git checkout HEAD^ &&
+	(
+		cd sub && git checkout HEAD^ && echo 4 >elif &&
+		git add elif && git commit -m "submodule conflict"
+	) &&
+	git add sub &&
+	test_tick &&
+	git commit -m "Conflict in submodule" &&
+	git tag submodule-topic
+'
+
+test_expect_success 'rebase -i continue with only submodule staged' '
+	test_must_fail git rebase -i submodule-base &&
+	git add sub &&
+	git rebase --continue &&
+	test $(git rev-parse submodule-base) != $(git rev-parse HEAD)
+'
+
+test_expect_success 'rebase -i continue with unstaged submodule' '
+	git checkout submodule-topic &&
+	git reset --hard &&
+	test_must_fail git rebase -i submodule-base &&
+	git reset &&
+	git rebase --continue &&
+	test $(git rev-parse submodule-base) = $(git rev-parse HEAD)
+'
+
 test_expect_success 'avoid unnecessary reset' '
 	git checkout master &&
+	git reset --hard &&
 	test-chmtime =123456789 file3 &&
 	git update-index --refresh &&
 	HEAD=$(git rev-parse HEAD) &&
-- 
1.7.8.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rebase -i continue: Don't skip submodule only commits
  2012-04-07 10:20 [PATCH] rebase -i continue: Don't skip submodule only commits John Keeping
@ 2012-04-09 22:09 ` Junio C Hamano
  2012-04-11 18:23   ` Jens Lehmann
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2012-04-09 22:09 UTC (permalink / raw)
  To: John Keeping; +Cc: git, Jens Lehmann

John Keeping <john@keeping.me.uk> writes:

> When git-rebase--interactive stops due to a conflict and the only change
> to be committed is in a submodule, the test for whether there is
> anything to be committed ignores the staged submodule change.  This
> leads rebase to skip creating the commit for the change.
>
> While unstaged submodule changes should be ignored to avoid needing to
> update submodules during a rebase, it is safe to remove the
> --ignore-submodules option to diff-index because --cached ensures that
> it is only checking the index.  This was discussed in [1] and a test is
> included to ensure that unstaged changes are still ignored correctly.
>
> [1] http://thread.gmane.org/gmane.comp.version-control.git/188713
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---

Very well explained and sensible.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rebase -i continue: Don't skip submodule only commits
  2012-04-09 22:09 ` Junio C Hamano
@ 2012-04-11 18:23   ` Jens Lehmann
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Lehmann @ 2012-04-11 18:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: John Keeping, git

Am 10.04.2012 00:09, schrieb Junio C Hamano:
> John Keeping <john@keeping.me.uk> writes:
> 
>> When git-rebase--interactive stops due to a conflict and the only change
>> to be committed is in a submodule, the test for whether there is
>> anything to be committed ignores the staged submodule change.  This
>> leads rebase to skip creating the commit for the change.
>>
>> While unstaged submodule changes should be ignored to avoid needing to
>> update submodules during a rebase, it is safe to remove the
>> --ignore-submodules option to diff-index because --cached ensures that
>> it is only checking the index.  This was discussed in [1] and a test is
>> included to ensure that unstaged changes are still ignored correctly.
>>
>> [1] http://thread.gmane.org/gmane.comp.version-control.git/188713
>>
>> Signed-off-by: John Keeping <john@keeping.me.uk>
>> ---
> 
> Very well explained and sensible.

An obvious Ack from me and many thanks to John for providing the test
cases I didn't find the time to write!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-11 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-07 10:20 [PATCH] rebase -i continue: Don't skip submodule only commits John Keeping
2012-04-09 22:09 ` Junio C Hamano
2012-04-11 18:23   ` Jens Lehmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.