Rebase fails because of apply.whitespace setting
- From
- John Feuerstein <john@feurix.com>
- Date
- Oct 19, 2009, 23:31 UTC
- Message-ID
- <4ADCF6E9.8090704@feurix.com>
I had to rewrite history recently (ugh -- private repo, not shared with anybody) and wanted to change the commit message of the root commit. During this I've encountered a failing git-rebase if apply.whitespace is set to "error".
Should whitespace-errors really be detected when rebasing? (or worse: be "fixed" without explicitely asking for it when using a global apply.whitespace=fix setting) What about making --ignore-whitespace the default for git-rebase?
Simplified example:
$ mkdir test $ cd test/ $ git config apply.whitespace error $ git init Initialized empty Git repository in /home/john/test/.git/ $ git commit --allow-empty -m 'root commit' [master (root-commit) a208f9f] root commit $ echo ' ' > whitespace $ git add whitespace $ git commit -m 'add whitespace file' [master 12b685b] add whitespace file 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 whitespace $ git tag root a208f9f $ git checkout -b new-root root Switched to a new branch 'new-root' $ git commit --amend --allow-empty -m 'changed root commit' [new-root b9adb89] changed root commit $ git checkout - Switched to branch 'master' $ git rebase --onto new-root root First, rewinding head to replay your work on top of it... Applying: add whitespace file Patch failed at 0001 add whitespace file
When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort".
$ git diff $ git status $ git apply .git/rebase-apply/0001 .git/rebase-apply/0001:17: trailing whitespace.
fatal: 1 line adds whitespace errors.