* [PATCH v2] Fix git rebase --continue to work with touched files
@ 2010-07-28 8:20 David D. Kilzer
2010-07-28 17:23 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: David D. Kilzer @ 2010-07-28 8:20 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin, David D. Kilzer
When performing a non-interactive rebase, sometimes
"git rebase --continue" will fail if an unmodified file is
touched in the working directory:
You must edit all merge conflicts and then
mark them as resolved using git add
This is caused by "git diff-files" reporting a difference
between the index and the filesystem:
:100644 100644 d00491...... 000000...... M file
The fix is to run "git update-index --refresh" before
"git diff-files" as is done in git-rebase--interactive.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Changes since v1:
- Updated test script based on list feedback. Thanks!
* Replaced while loop in original test with test-chmtime.
* Switched to use test_commit.
- Added test case for the same issue in git-rebase--interactive
that was already fixed, and verified that the test breaks when
the fix is removed.
git-rebase.sh | 1 +
t/t3418-rebase-continue.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
create mode 100755 t/t3418-rebase-continue.sh
diff --git a/git-rebase.sh b/git-rebase.sh
index ab4afa7..2d88742 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -208,6 +208,7 @@ do
test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply ||
die "No rebase in progress?"
+ git update-index --ignore-submodules --refresh &&
git diff-files --quiet --ignore-submodules || {
echo "You must edit all merge conflicts and then"
echo "mark them as resolved using git add"
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
new file mode 100755
index 0000000..3b0d273
--- /dev/null
+++ b/t/t3418-rebase-continue.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+test_description='git rebase --continue tests'
+
+. ./test-lib.sh
+
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+set_fake_editor
+
+test_expect_success 'setup' '
+ test_commit "commit-new-file-F1" F1 1 &&
+ test_commit "commit-new-file-F2" F2 2 &&
+
+ git checkout -b topic HEAD^ &&
+ test_commit "commit-new-file-F2-on-topic-branch" F2 22 &&
+
+ git checkout master
+'
+
+test_expect_success 'interactive rebase --continue works with touched file' '
+ rm -fr .git/rebase-* &&
+ git reset --hard &&
+ git checkout master &&
+
+ FAKE_LINES="edit 1" git rebase -i HEAD^ &&
+ test-chmtime =-60 F1 &&
+ git rebase --continue
+'
+
+test_expect_success 'non-interactive rebase --continue works with touched file' '
+ rm -fr .git/rebase-* &&
+ git reset --hard &&
+ git checkout master &&
+
+ test_must_fail git rebase --onto master master topic &&
+ echo "Resolved" >F2 &&
+ git add F2 &&
+ test-chmtime =-60 F1 &&
+ git rebase --continue
+'
+
+test_done
--
1.7.2.25.gd0768
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Fix git rebase --continue to work with touched files
2010-07-28 8:20 [PATCH v2] Fix git rebase --continue to work with touched files David D. Kilzer
@ 2010-07-28 17:23 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2010-07-28 17:23 UTC (permalink / raw)
To: David D. Kilzer; +Cc: git, Johannes Schindelin
Reasonable. Thanks, both.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-28 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28 8:20 [PATCH v2] Fix git rebase --continue to work with touched files David D. Kilzer
2010-07-28 17:23 ` Junio C Hamano
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).