{"thread":{"id":"11771","subject":"git-rebase doesn't work when trying to squash changes into commits created with --no-verify","startedAt":"2008-01-28T15:42:32Z","lastAt":"2008-01-29T02:24:45Z","messageCount":3,"participants":["Gerrit Pape","Johannes Schindelin","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"66751","messageId":"20080128154232.900.qmail@c07ab49f5b12dd.315fe32.mid.smarden.org","threadId":"11771","inReplyTo":null,"subject":"git-rebase doesn't work when trying to squash changes into commits created with --no-verify","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-01-28T15:42:32Z","receivedAt":"2008-01-28T15:42:32Z","isPatch":false,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"Hi, IIRC I managed to reproduce the problem below, but currently don't\nhave the time to track it down.  Hopefully someone else can work on it,\nthere's even a patch suggested.\n\nThanks, Gerrit.\n\n\nhttp://bugs.debian.org/458782:\n\n----- Forwarded message from Raphael Hertzog <hertzog@debian.org> -----\n\nSubject: Bug#458782: git-core: git-rebase doesn't work when trying to squash\n\tchanges into commits created with --no-verify\nReply-To: Raphael Hertzog <hertzog@debian.org>, 458782@bugs.debian.org\nFrom: Raphael Hertzog <hertzog@debian.org>\nTo: Debian Bug Tracking System <submit@bugs.debian.org>\nDate: Wed, 02 Jan 2008 21:27:35 +0100\n\nI recently worked on a branch where I had to commit some test files that\nhad trailing whitespaces (those files were used in a non-regression test\nand the trailing spaces were required and deliberate). Since I have the\nstandard pre-commit hook enabled, this required me to add --no-verify to\nthe \"git commit\" invocation.\n\nLater I discovered a bug in that commit and wanted to merge another change\ninto it using \"git rebase -i\" and something like that:\npick 1a5c8d6 The commit created with git commit --no-verify\nsquash 57e9f03 A bugfix on top of the previous commit\npick 120ecd5 Next commit\n\nThe result is that the rebase process failed badly:\nRebasing (14/21)\n* You have some suspicious patch lines:\n*\n* In scripts/t/700_Dpkg_Control.t\n* trailing whitespace (line 27)\nscripts/t/700_Dpkg_Control.t:27:Empty-Field: \n* trailing whitespace (line 44)\nscripts/t/700_Dpkg_Control.t:44:is($src->{'long-field'}, \n* In scripts/t/700_Dpkg_Control/control-1\n* trailing whitespace (line 8)\nscripts/t/700_Dpkg_Control/control-1:8:empty-field: \n* trailing whitespace (line 9)\nscripts/t/700_Dpkg_Control/control-1:9:     \nfatal: Entry 'ChangeLog' would be overwritten by merge. Cannot merge.\nAutomatic cherry-pick failed.  After resolving the conflicts,\nmark the corrected paths with 'git add <paths>' and commit the result.\nWhen commiting, use the option '-c 120ecd5' to retain authorship and message.\nCould not apply 120ecd5... Next commit\n\nThe situation is the following :\n- the index contained the result of the pick + squash\n- the error message indicated to commit with -c 4c01fe, that is with the\n  information coming from the next commit of the rebase process... it\n  looks like the rebase process marked the previous step as done when in\n  fact the commit wasn't created due to lack of --no-verify.\n\nThe (quick) fix is the following :\n--- /tmp/git-rebase--interactive\t2008-01-02 21:24:00.000000000 +0100\n+++ /usr/bin/git-rebase--interactive\t2008-01-02 21:24:04.000000000 +0100\n@@ -272,7 +272,7 @@\n \t\t\t# This is like --amend, but with a different message\n \t\t\teval \"$author_script\"\n \t\t\texport GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE\n-\t\t\t$USE_OUTPUT git commit -F \"$MSG\" $EDIT_COMMIT\n+\t\t\t$USE_OUTPUT git commit --no-verify -F \"$MSG\" $EDIT_COMMIT\n \t\t\t;;\n \t\tt)\n \t\t\tcp \"$MSG\" \"$GIT_DIR\"/MERGE_MSG\n\n\n-- System Information:\nDebian Release: lenny/sid\n  APT prefers unstable\n  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')\nArchitecture: i386 (i686)\n\nKernel: Linux 2.6.23-1-686 (SMP w/1 CPU core)\nLocale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)\nShell: /bin/sh linked to /bin/bash\n\nVersions of packages git-core depends on:\nii  cpio                    2.9-9            GNU cpio -- a program to manage ar\nii  libc6                   2.7-5            GNU C Library: Shared libraries\nii  libcurl3-gnutls         7.17.1-1         Multi-protocol file transfer libra\nii  libdigest-sha1-perl     2.11-2           NIST SHA-1 message digest algorith\nii  liberror-perl           0.17-1           Perl module for error/exception ha\nii  libexpat1               1.95.8-4         XML parsing C library - runtime li\nii  perl-modules            5.8.8-12         Core Perl modules\nii  zlib1g                  1:1.2.3.3.dfsg-8 compression library - runtime\n\nVersions of packages git-core recommends:\nii  curl                         7.17.1-1    Get a file from an HTTP, HTTPS or \nii  git-doc                      1:1.5.3.7-1 fast, scalable, distributed revisi\nii  less                         409-1       Pager program similar to more\nii  openssh-client [ssh-client]  1:4.7p1-1   secure shell client, an rlogin/rsh\nii  patch                        2.5.9-4     Apply a diff file to an original\nii  rsync                        2.6.9-6     fast remote file copy program (lik\n\n-- no debconf information\n\n\n\n----- End forwarded message -----\n"},{"id":"66752","messageId":"alpine.LSU.1.00.0801281632300.23907@racer.site","threadId":"11771","inReplyTo":"20080128154232.900.qmail@c07ab49f5b12dd.315fe32.mid.smarden.org","subject":"[PATCH] Add test for rebase -i with commits that do not pass pre-commit","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-28T16:33:28Z","receivedAt":"2008-01-28T16:33:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis accompanies c5b09feb(Avoid update hook during git-rebase --interactive)\nto prove that Debian's Bug#458782 (git-core: git-rebase doesn't work when\ntrying to squash changes into commits created with --no-verify) is indeed\nfixed now.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Mon, 28 Jan 2008, Gerrit Pape wrote:\n\n\t> Hi, IIRC I managed to reproduce the problem below, but currently \n\t> don't have the time to track it down.  Hopefully someone else \n\t> can work on it, there's even a patch suggested.\n\n\tIt is even in 1.5.4-rc1.\n\n t/t3404-rebase-interactive.sh |   16 ++++++++++++++++\n 1 files changed, 16 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 74a7eb3..e33ea4e 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -324,4 +324,20 @@ test_expect_success 'rebase a detached HEAD' '\n \ttest $grandparent = $(git rev-parse HEAD~2)\n '\n \n+test_expect_success 'rebase a commit violating pre-commit' '\n+\n+\tmkdir -p .git/hooks &&\n+\tPRE_COMMIT=.git/hooks/pre-commit &&\n+\techo \"#!/bin/sh\" > $PRE_COMMIT &&\n+\techo \"test -z \\\"\\$(git diff --cached --check)\\\"\" >> $PRE_COMMIT &&\n+\tchmod a+x $PRE_COMMIT &&\n+\techo \"monde! \" >> file1 &&\n+\ttest_tick &&\n+\t! git commit -m doesnt-verify file1 &&\n+\tgit commit -m doesnt-verify --no-verify file1 &&\n+\ttest_tick &&\n+\tFAKE_LINES=2 git rebase -i HEAD~2\n+\n+'\n+\n test_done\n-- \n1.5.4.rc5.15.g8231f\n"},{"id":"66775","messageId":"20080129022445.GG24004@spearce.org","threadId":"11771","inReplyTo":"alpine.LSU.1.00.0801281632300.23907@racer.site","subject":"Re: [PATCH] Add test for rebase -i with commits that do not pass pre-commit","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-01-29T02:24:45Z","receivedAt":"2008-01-29T02:24:45Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> This accompanies c5b09feb(Avoid update hook during git-rebase --interactive)\n\nwtf was I smoking when I wrote that commit subject line?  Its not\nthe update hook we're avoiding here.  But yea, I thought this looked\nlike something I had worked on recently.  :)\n\n> to prove that Debian's Bug#458782 (git-core: git-rebase doesn't work when\n> trying to squash changes into commits created with --no-verify) is indeed\n> fixed now.\n\n-- \nShawn.\n"}]}