From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?QmrDtnJuIEd1c3RhdnNzb24=?= Subject: [PATCH v3 5/5] t3417: Add test cases for "rebase --whitespace=fix" Date: Sat, 27 Feb 2010 14:52:50 +0100 Message-ID: <4B8923B2.8020609@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sat Feb 27 14:53:28 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NlN6H-00081x-Uc for gcvg-git-2@lo.gmane.org; Sat, 27 Feb 2010 14:52:58 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968360Ab0B0Nww convert rfc822-to-quoted-printable (ORCPT ); Sat, 27 Feb 2010 08:52:52 -0500 Received: from mail-ew0-f220.google.com ([209.85.219.220]:55312 "EHLO mail-ew0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968349Ab0B0Nww (ORCPT ); Sat, 27 Feb 2010 08:52:52 -0500 Received: by mail-ew0-f220.google.com with SMTP id 20so535804ewy.21 for ; Sat, 27 Feb 2010 05:52:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=kV5ZYXl1c/Mb1R8xBlRv1uMPFMd0XytCv2vz6xBd0kY=; b=Nz9gOybW17j1lln7BQ0Tpn9/tbqoQq7y0Li3FCsxejNJUPscX3nTqLHwswhXP4g0+S S4QFu34e2891gC0xrO3tnsgccBrkhN4PmJT4kb/2okfkSJalsnxZUEPpKBLFa1CweA00 bT29RUlgeVkQ8Q0bRtRpINpfp+PdYg74QPbdA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=wo6LB0K5bYUiXEJRflcE3oX5jo2ledusnDcE/d4x5p/A5himFsV6fqyFGut3rSimx2 4p49XEn2iYK3EZphQ0v6s/TBfOjbeMSdNBe0iJQxw0yGSneu/SeMUpH8xRW3EkV8Vy8z mVzPQKTuTO/x8nxS6HvucdZMbTBpUbNyxKgK4= Received: by 10.213.40.133 with SMTP id k5mr1219771ebe.94.1267278771382; Sat, 27 Feb 2010 05:52:51 -0800 (PST) Received: from ?10.0.1.10? (81-234-150-173-no94.tbcn.telia.com [81.234.150.173]) by mx.google.com with ESMTPS id 23sm5027478eya.10.2010.02.27.05.52.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 27 Feb 2010 05:52:50 -0800 (PST) User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: The command "git rebase --whitespace=3Dfix HEAD~" is supposed to only clean up trailing whitespace, and the expectation is that it cannot fail. Unfortunately, if one commit adds a blank line at the end of a file and a subsequent commit adds more non-blank lines after the blank line, "git apply" (used indirectly by "git rebase") will fail to apply the patch of the second commit. Signed-off-by: Bj=C3=B6rn Gustavsson --- t/t3417-rebase-whitespace-fix.sh | 126 ++++++++++++++++++++++++++++++= ++++++++ 1 files changed, 126 insertions(+), 0 deletions(-) create mode 100755 t/t3417-rebase-whitespace-fix.sh diff --git a/t/t3417-rebase-whitespace-fix.sh b/t/t3417-rebase-whitespa= ce-fix.sh new file mode 100755 index 0000000..220a740 --- /dev/null +++ b/t/t3417-rebase-whitespace-fix.sh @@ -0,0 +1,126 @@ +#!/bin/sh + +test_description=3D'git rebase --whitespace=3Dfix + +This test runs git rebase --whitespace=3Dfix and make sure that it wor= ks. +' + +. ./test-lib.sh + +# prepare initial revision of "file" with a blank line at the end +cat >file <expect-first <second <expect-second <third <expect-third + +test_expect_success 'two blanks line at end of file; extend at end of = file' ' + cp third file && git add file && git commit -m third && + git rebase --whitespace=3Dfix HEAD^^ && + git diff --exit-code HEAD^:file expect-second && + test_cmp file expect-third +' + +test_expect_success 'same, but do not remove trailing spaces' ' + git config core.whitespace "-blank-at-eol" && + git reset --hard HEAD^ && + cp third file && git add file && git commit -m third && + git rebase --whitespace=3Dfix HEAD^^ + git diff --exit-code HEAD^:file expect-second && + test_cmp file third +' + +sed -e's/Z//' >beginning <expect-beginning <> file && + git commit -m more file && + git rebase --whitespace=3Dfix HEAD^^ && + test_cmp file expect-beginning +' + +test_done --=20 1.7.0