git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git rebase -i / git-gui bug
@ 2007-12-20  0:35 Bernt Hansen
  2007-12-20  4:47 ` Bernt Hansen
  2007-12-24 14:31 ` [PATCH] Force new line at end of commit message Bernt Hansen
  0 siblings, 2 replies; 29+ messages in thread
From: Bernt Hansen @ 2007-12-20  0:35 UTC (permalink / raw)
  To: Shawn O. Pearce, Johannes Schindelin, Junio C Hamano; +Cc: git

Thanks for a great tool I use everyday!

I'm using the tip of master for my regular day job with git-gui to write
the commit messages.  I've run into a little glitch with git rebase -i
and git-gui.

$ git --version
git version 1.5.4.rc0.73.gce85b

I haven't been able to automate the process of reproducing this but the
steps are fairly simple.

To show the problem you can create a test repository using the following
script:

--- t1.sh ---
#!/bin/sh
cd /tmp
mkdir t1
cd t1
git init

for F in f1 f2 f3 f4 f5 f6 f7 f8 f9 f10; do
  echo $F >$F
  git add $F
  echo -n -e "Commit for $F\n\nThis is line one\nThis is line two" >/tmp/commitmsg.txt 
  git commit -F /tmp/commitmsg.txt
done
-------------

Now cd /tmp/t1 and do the following:

$ git rebase -i HEAD~9

Change all lines with 'pick' to 'edit'

For each of the 10 commits use git-gui to select 'Amend Last Commit' and
just hit the [Commit] button (you can change the text if you want but
it's not necessary to show the problem)

$ git rebase --continue
after each commit and repeat until the rebase is complete.

Now if you try to squash these commits the edit buffer commit text is a
little mangled.

$ git rebase -i HEAD~9

Change all but the first pick line to 'squash' and I get the following
text in the commit message edit window:

----[ /tmp/t1/.git/COMMIT_EDITMSG ]----
# This is a combination of 3 commits.
# The first commit's message is:

Commit for f2

This is line one
This is line two
# This is the 2nd commit message:

Commit for f3

This is line one
This is line two# This is the 3rd commit message:

Commit for f4

This is line one
This is line two# This is the 3rd commit message:

Commit for f5

This is line one
This is line two# This is the 3rd commit message:

Commit for f6

This is line one
This is line two# This is the 3rd commit message:

Commit for f7

This is line one
This is line two# This is the 3rd commit message:

Commit for f8

This is line one
This is line two# This is the 3rd commit message:

Commit for f9

This is line one
This is line two# This is the 3rd commit message:

Commit for f10

This is line one
This is line two

# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# Not currently on any branch.
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   f10
#	new file:   f2
#	new file:   f3
#	new file:   f4
#	new file:   f5
#	new file:   f6
#	new file:   f7
#	new file:   f8
#	new file:   f9
#
---------------------------------------

Notice after the 3rd commit the '# This is the 3rd commit message:' is
appended to the last line of the previous commit message and the counter
seems to be stuck on 3.

---

When I run into this during work I fix up the commit text by adding
newlines before the '# This is the 3rd commit message' and it works
fine.

This might be the lack of a newline after the last line in the commit
edit message when git-gui creates the commit -- maybe.

If I use git --amend instead of git-gui to update the commits on the
above test repository it works correctly.

I'm posting this because someone else can probably fix this faster than
me (I've never looked at the git source code).  I'll post a patch when I
figure it out if nobody else beats me to it.

Regards,
Bernt

^ permalink raw reply	[flat|nested] 29+ messages in thread
[parent not found: <200712301158.lBUBwT3u004608@mi1.bluebottle.com>]

end of thread, other threads:[~2007-12-30 15:52 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-20  0:35 git rebase -i / git-gui bug Bernt Hansen
2007-12-20  4:47 ` Bernt Hansen
2007-12-20  7:12   ` [PATCH] Reallow git-rebase --interactive --continue if commit is unnecessary Shawn O. Pearce
2007-12-20  7:15     ` Junio C Hamano
2007-12-20  7:31       ` Shawn O. Pearce
2007-12-20  9:35         ` Junio C Hamano
2007-12-26 23:48           ` Junio C Hamano
2007-12-29 13:26             ` Johannes Schindelin
2007-12-20  7:52     ` Matthieu Moy
2007-12-24 14:31 ` [PATCH] Force new line at end of commit message Bernt Hansen
2007-12-24 17:38   ` Johannes Schindelin
2007-12-25  4:42     ` Shawn O. Pearce
2007-12-25  9:34       ` Junio C Hamano
2007-12-26 17:47       ` Bernt Hansen
2007-12-27  4:19         ` Shawn O. Pearce
2007-12-28  2:15           ` [PATCH] git-gui: Make commit log messages end with a newline Bernt Hansen
2007-12-26 19:36       ` [PATCH] Force new line at end of commit message Junio C Hamano
2007-12-29 13:31         ` Johannes Schindelin
2007-12-30  0:19           ` Junio C Hamano
2007-12-30 10:26             ` Johannes Schindelin
2007-12-30 10:51               ` Junio C Hamano
2007-12-30 11:03                 ` Johannes Schindelin
2007-12-30 11:45                   ` Junio C Hamano
2007-12-30 11:57                     ` しらいしななこ
2007-12-30 12:21                       ` Junio C Hamano
2007-12-30 12:05                     ` Junio C Hamano
2007-12-30 15:50                     ` Johannes Schindelin
2007-12-25  4:46   ` Shawn O. Pearce
     [not found] <200712301158.lBUBwT3u004608@mi1.bluebottle.com>
2007-12-30 15:51 ` 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).