[PATCH] Add a test for a problem in "rebase --whitespace=fix"
- From
Björn Gustavsson <bgustavsson@gmail.com>
- Date
- Feb 7, 2010, 08:10 UTC
- Message-ID
- <4B6E7564.7040109@gmail.com>
The command "git rebase --whitespace=fix HEAD~<N>" 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örn Gustavsson <bgustavsson@gmail.com> --- t/t3417-rebase-whitespace-fix.sh | 45 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 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-whitespace-fix.sh new file mode 100755 index 0000000..55cbce7 --- /dev/null +++ b/t/t3417-rebase-whitespace-fix.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +test_description='git rebase --whitespace=fix + +This test runs git rebase --whitespace=fix and make sure that it works. +' + +. ./test-lib.sh + +# prepare initial revision of "file" with a blank line at the end +cat >file <<EOF +a +b +c + +EOF + +# expected contents in "file" after rebase +cat >expect <<EOF +a +b +c +EOF + +# prepare second revision of "file" +cat >second <<EOF +a +b +c + +d +e +f +EOF + +test_expect_failure 'blanks line at end of file; extend at end of file' ' + git commit --allow-empty -m "Initial empty commit" && + git add file && git commit -m first && + mv second file && + git add file && git commit -m second && + git rebase --whitespace=fix HEAD^^ && + git diff --exit-code HEAD^:file expect +' + +test_done
-- 1.7.0.rc1.46.g04bf4