* git-rebase doesn't work when trying to squash changes into commits created with --no-verify
@ 2008-01-28 15:42 Gerrit Pape
2008-01-28 16:33 ` [PATCH] Add test for rebase -i with commits that do not pass pre-commit Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Gerrit Pape @ 2008-01-28 15:42 UTC (permalink / raw)
To: git
Hi, IIRC I managed to reproduce the problem below, but currently don't
have the time to track it down. Hopefully someone else can work on it,
there's even a patch suggested.
Thanks, Gerrit.
http://bugs.debian.org/458782:
----- Forwarded message from Raphael Hertzog <hertzog@debian.org> -----
Subject: Bug#458782: git-core: git-rebase doesn't work when trying to squash
changes into commits created with --no-verify
Reply-To: Raphael Hertzog <hertzog@debian.org>, 458782@bugs.debian.org
From: Raphael Hertzog <hertzog@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Date: Wed, 02 Jan 2008 21:27:35 +0100
I recently worked on a branch where I had to commit some test files that
had trailing whitespaces (those files were used in a non-regression test
and the trailing spaces were required and deliberate). Since I have the
standard pre-commit hook enabled, this required me to add --no-verify to
the "git commit" invocation.
Later I discovered a bug in that commit and wanted to merge another change
into it using "git rebase -i" and something like that:
pick 1a5c8d6 The commit created with git commit --no-verify
squash 57e9f03 A bugfix on top of the previous commit
pick 120ecd5 Next commit
The result is that the rebase process failed badly:
Rebasing (14/21)
* You have some suspicious patch lines:
*
* In scripts/t/700_Dpkg_Control.t
* trailing whitespace (line 27)
scripts/t/700_Dpkg_Control.t:27:Empty-Field:
* trailing whitespace (line 44)
scripts/t/700_Dpkg_Control.t:44:is($src->{'long-field'},
* In scripts/t/700_Dpkg_Control/control-1
* trailing whitespace (line 8)
scripts/t/700_Dpkg_Control/control-1:8:empty-field:
* trailing whitespace (line 9)
scripts/t/700_Dpkg_Control/control-1:9:
fatal: Entry 'ChangeLog' would be overwritten by merge. Cannot merge.
Automatic cherry-pick failed. After resolving the conflicts,
mark the corrected paths with 'git add <paths>' and commit the result.
When commiting, use the option '-c 120ecd5' to retain authorship and message.
Could not apply 120ecd5... Next commit
The situation is the following :
- the index contained the result of the pick + squash
- the error message indicated to commit with -c 4c01fe, that is with the
information coming from the next commit of the rebase process... it
looks like the rebase process marked the previous step as done when in
fact the commit wasn't created due to lack of --no-verify.
The (quick) fix is the following :
--- /tmp/git-rebase--interactive 2008-01-02 21:24:00.000000000 +0100
+++ /usr/bin/git-rebase--interactive 2008-01-02 21:24:04.000000000 +0100
@@ -272,7 +272,7 @@
# This is like --amend, but with a different message
eval "$author_script"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
- $USE_OUTPUT git commit -F "$MSG" $EDIT_COMMIT
+ $USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT
;;
t)
cp "$MSG" "$GIT_DIR"/MERGE_MSG
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.23-1-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages git-core depends on:
ii cpio 2.9-9 GNU cpio -- a program to manage ar
ii libc6 2.7-5 GNU C Library: Shared libraries
ii libcurl3-gnutls 7.17.1-1 Multi-protocol file transfer libra
ii libdigest-sha1-perl 2.11-2 NIST SHA-1 message digest algorith
ii liberror-perl 0.17-1 Perl module for error/exception ha
ii libexpat1 1.95.8-4 XML parsing C library - runtime li
ii perl-modules 5.8.8-12 Core Perl modules
ii zlib1g 1:1.2.3.3.dfsg-8 compression library - runtime
Versions of packages git-core recommends:
ii curl 7.17.1-1 Get a file from an HTTP, HTTPS or
ii git-doc 1:1.5.3.7-1 fast, scalable, distributed revisi
ii less 409-1 Pager program similar to more
ii openssh-client [ssh-client] 1:4.7p1-1 secure shell client, an rlogin/rsh
ii patch 2.5.9-4 Apply a diff file to an original
ii rsync 2.6.9-6 fast remote file copy program (lik
-- no debconf information
----- End forwarded message -----
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Add test for rebase -i with commits that do not pass pre-commit
2008-01-28 15:42 git-rebase doesn't work when trying to squash changes into commits created with --no-verify Gerrit Pape
@ 2008-01-28 16:33 ` Johannes Schindelin
2008-01-29 2:24 ` Shawn O. Pearce
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2008-01-28 16:33 UTC (permalink / raw)
To: Gerrit Pape; +Cc: git
This accompanies c5b09feb(Avoid update hook during git-rebase --interactive)
to prove that Debian's Bug#458782 (git-core: git-rebase doesn't work when
trying to squash changes into commits created with --no-verify) is indeed
fixed now.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Mon, 28 Jan 2008, Gerrit Pape wrote:
> Hi, IIRC I managed to reproduce the problem below, but currently
> don't have the time to track it down. Hopefully someone else
> can work on it, there's even a patch suggested.
It is even in 1.5.4-rc1.
t/t3404-rebase-interactive.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 74a7eb3..e33ea4e 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -324,4 +324,20 @@ test_expect_success 'rebase a detached HEAD' '
test $grandparent = $(git rev-parse HEAD~2)
'
+test_expect_success 'rebase a commit violating pre-commit' '
+
+ mkdir -p .git/hooks &&
+ PRE_COMMIT=.git/hooks/pre-commit &&
+ echo "#!/bin/sh" > $PRE_COMMIT &&
+ echo "test -z \"\$(git diff --cached --check)\"" >> $PRE_COMMIT &&
+ chmod a+x $PRE_COMMIT &&
+ echo "monde! " >> file1 &&
+ test_tick &&
+ ! git commit -m doesnt-verify file1 &&
+ git commit -m doesnt-verify --no-verify file1 &&
+ test_tick &&
+ FAKE_LINES=2 git rebase -i HEAD~2
+
+'
+
test_done
--
1.5.4.rc5.15.g8231f
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Add test for rebase -i with commits that do not pass pre-commit
2008-01-28 16:33 ` [PATCH] Add test for rebase -i with commits that do not pass pre-commit Johannes Schindelin
@ 2008-01-29 2:24 ` Shawn O. Pearce
0 siblings, 0 replies; 3+ messages in thread
From: Shawn O. Pearce @ 2008-01-29 2:24 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Gerrit Pape, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> This accompanies c5b09feb(Avoid update hook during git-rebase --interactive)
wtf was I smoking when I wrote that commit subject line? Its not
the update hook we're avoiding here. But yea, I thought this looked
like something I had worked on recently. :)
> to prove that Debian's Bug#458782 (git-core: git-rebase doesn't work when
> trying to squash changes into commits created with --no-verify) is indeed
> fixed now.
--
Shawn.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-29 2:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-28 15:42 git-rebase doesn't work when trying to squash changes into commits created with --no-verify Gerrit Pape
2008-01-28 16:33 ` [PATCH] Add test for rebase -i with commits that do not pass pre-commit Johannes Schindelin
2008-01-29 2:24 ` Shawn O. Pearce
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).