git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits
@ 2007-07-12 22:30 Alex Riesen
  2007-07-14  5:34 ` Junio C Hamano
  2007-07-14  9:53 ` Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Riesen @ 2007-07-12 22:30 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

Without this change the commits will be left standalone, with
duplicated commit message.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Noticed when trying to blend the second commit in a branch into the
first. Squash didn't work at all (apart from commit message
duplication).

 git-rebase--interactive.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index d9563ec..f395076 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -84,6 +84,7 @@ pick_one () {
 	current_sha1=$(git rev-parse --verify HEAD)
 	if [ $current_sha1 = $parent_sha1 ]; then
 		git reset --hard $sha1
+		test "a$1" = a-n && git reset --soft $current_sha1
 		sha1=$(git rev-parse --short $sha1)
 		warn Fast forward to $sha1
 	else
@@ -193,14 +194,14 @@ do_next () {
 			die "Cannot 'squash' without a previous commit"
 
 		mark_action_done
-		failed=f
-		pick_one -n $sha1 || failed=t
 		MSG="$DOTEST"/message
 		echo "# This is a combination of two commits." > "$MSG"
 		echo "# The first commit's message is:" >> "$MSG"
 		echo >> "$MSG"
 		git cat-file commit HEAD | sed -e '1,/^$/d' >> "$MSG"
 		echo >> "$MSG"
+		failed=f
+		pick_one -n $sha1 || failed=t
 		echo "# And this is the 2nd commit message:" >> "$MSG"
 		echo >> "$MSG"
 		git cat-file commit $sha1 | sed -e '1,/^$/d' >> "$MSG"
-- 
1.5.3.rc0.116.gc35c1-dirty

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

* Re: [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits
  2007-07-12 22:30 [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits Alex Riesen
@ 2007-07-14  5:34 ` Junio C Hamano
  2007-07-14  7:09   ` Andy Parkins
  2007-07-14  9:53 ` Johannes Schindelin
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-07-14  5:34 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Johannes Schindelin

I think this makes sense.  Thanks for fixing it up.

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

* Re: [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits
  2007-07-14  5:34 ` Junio C Hamano
@ 2007-07-14  7:09   ` Andy Parkins
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Parkins @ 2007-07-14  7:09 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Alex Riesen, Johannes Schindelin

On Saturday 2007, July 14, Junio C Hamano wrote:
> I think this makes sense.  Thanks for fixing it up.

I was experiencing the problem, and this patch fixed it.


Acked-by: Andy Parkins


-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

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

* Re: [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits
  2007-07-12 22:30 [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits Alex Riesen
  2007-07-14  5:34 ` Junio C Hamano
@ 2007-07-14  9:53 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2007-07-14  9:53 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Junio C Hamano

Hi,

On Fri, 13 Jul 2007, Alex Riesen wrote:

> Without this change the commits will be left standalone, with
> duplicated commit message.

Thanks.

Ciao,
Dscho

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

end of thread, other threads:[~2007-07-14  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 22:30 [PATCH] Fix git-rebase -i to allow squashing of fast-forwardable commits Alex Riesen
2007-07-14  5:34 ` Junio C Hamano
2007-07-14  7:09   ` Andy Parkins
2007-07-14  9:53 ` Johannes Schindelin

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