git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug?] rebase-i marking the last entry for edit gives a barf?
@ 2010-03-28 17:39 Junio C Hamano
  2010-03-28 18:14 ` Sverre Rabbelier
  2010-03-28 19:36 ` [PATCH] rebase -i: make post-rewrite work for 'edit' Thomas Rast
  0 siblings, 2 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-03-28 17:39 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git

I am getting this:

/home/junio/g/Debian-5.0.4-x86_64/git-next/libexec/git-core/git-rebase--interactive: line 565: /git/.git/rebase-merge/rewritten-list: No such file or directory
Successfully rebased and updated refs/heads/nd/setup.

This was after marking both commits in a two-patch series for "edit" in
rebase -i, running "commit --amend; rebase --continue; commit --amend";
saying "rebase --continue" at this point gave this error.

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

* Re: [Bug?] rebase-i marking the last entry for edit gives a barf?
  2010-03-28 17:39 [Bug?] rebase-i marking the last entry for edit gives a barf? Junio C Hamano
@ 2010-03-28 18:14 ` Sverre Rabbelier
  2010-03-28 19:36 ` [PATCH] rebase -i: make post-rewrite work for 'edit' Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Sverre Rabbelier @ 2010-03-28 18:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git

Heya,

On Sun, Mar 28, 2010 at 11:39, Junio C Hamano <gitster@pobox.com> wrote:
> This was after marking both commits in a two-patch series for "edit" in
> rebase -i, running "commit --amend; rebase --continue; commit --amend";
> saying "rebase --continue" at this point gave this error.

I noticed the same as well, so it's not just you :).

-- 
Cheers,

Sverre Rabbelier

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

* [PATCH] rebase -i: make post-rewrite work for 'edit'
  2010-03-28 17:39 [Bug?] rebase-i marking the last entry for edit gives a barf? Junio C Hamano
  2010-03-28 18:14 ` Sverre Rabbelier
@ 2010-03-28 19:36 ` Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Rast @ 2010-03-28 19:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sverre Rabbelier, git

The post-rewrite support, in the form of the call to
'record_in_rewritten', was hidden in the arm where we have to record a
new commit for the user.  This meant that it was never invoked in the
case where the user has already amended the commit by herself.

[The test is designed to exercise both arms of the 'if' in question.]

Furthermore, recording the stopped-sha (the SHA1 of the commit before
the editing) suffered from a cut&paste error from die_with_patch and
used the wrong variable, hence it never recorded anything.

Noticed by Junio.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

Junio C Hamano wrote:
> I am getting this:
> 
> /home/junio/g/Debian-5.0.4-x86_64/git-next/libexec/git-core/git-rebase--interactive: line 565: /git/.git/rebase-merge/rewritten-list: No such file or directory
> Successfully rebased and updated refs/heads/nd/setup.
> 
> This was after marking both commits in a two-patch series for "edit" in
> rebase -i, running "commit --amend; rebase --continue; commit --amend";
> saying "rebase --continue" at this point gave this error.

No need for question marks, this is not only a bug but also squarely
in the wtf-was-I-smoking department ;-)

I changed the test slightly from what you describe, to make it go
through both code paths (as indicated in the bracketed remark).


 git-rebase--interactive.sh   |    5 +++--
 t/t5407-post-rewrite-hook.sh |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a57f043..1d116bf 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -475,7 +475,7 @@ do_next () {
 		mark_action_done
 		pick_one $sha1 ||
 			die_with_patch $sha1 "Could not apply $sha1... $rest"
-		echo "$1" > "$DOTEST"/stopped-sha
+		echo "$sha1" > "$DOTEST"/stopped-sha
 		make_patch $sha1
 		git rev-parse --verify HEAD > "$AMEND"
 		warn "Stopped at $sha1... $rest"
@@ -723,9 +723,10 @@ first and then run 'git rebase --continue' again."
 				test -n "$amend" && git reset --soft $amend
 				die "Could not commit staged changes."
 			}
-			record_in_rewritten "$(cat "$DOTEST"/stopped-sha)"
 		fi
 
+		record_in_rewritten "$(cat "$DOTEST"/stopped-sha)"
+
 		require_clean_work_tree
 		do_rest
 		;;
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
index f0f91f1..552da65 100755
--- a/t/t5407-post-rewrite-hook.sh
+++ b/t/t5407-post-rewrite-hook.sh
@@ -180,4 +180,20 @@ EOF
 	verify_hook_input
 '
 
+test_expect_success 'git rebase -i (double edit)' '
+	git reset --hard D &&
+	clear_hook_input &&
+	FAKE_LINES="edit 1 edit 2" git rebase -i B &&
+	git rebase --continue &&
+	echo something > foo &&
+	git add foo &&
+	git rebase --continue &&
+	echo rebase >expected.args &&
+	cat >expected.data <<EOF &&
+$(git rev-parse C) $(git rev-parse HEAD^)
+$(git rev-parse D) $(git rev-parse HEAD)
+EOF
+	verify_hook_input
+'
+
 test_done
-- 
1.7.0.3.461.ga69fc

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

end of thread, other threads:[~2010-03-28 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28 17:39 [Bug?] rebase-i marking the last entry for edit gives a barf? Junio C Hamano
2010-03-28 18:14 ` Sverre Rabbelier
2010-03-28 19:36 ` [PATCH] rebase -i: make post-rewrite work for 'edit' Thomas Rast

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).