git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Rebase fails because of apply.whitespace setting

From
JFJohn 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.
Next: Junio C Hamano
Message 1 of 2 in “Rebase fails because of apply.whitespace setting”
  1. John FeuersteinOct 19, 2009
  2. Junio C HamanoOct 19, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.