{"thread":{"id":"21285","subject":"Rebase fails because of apply.whitespace setting","startedAt":"2009-10-19T23:31:53Z","lastAt":"2009-10-19T23:53:52Z","messageCount":2,"participants":["John Feuerstein","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"125425","messageId":"4ADCF6E9.8090704@feurix.com","threadId":"21285","inReplyTo":null,"subject":"Rebase fails because of apply.whitespace setting","fromName":"John Feuerstein","fromEmail":"john@feurix.com","sentAt":"2009-10-19T23:31:53Z","receivedAt":"2009-10-19T23:31:53Z","isPatch":false,"sender":{"key":"john@feurix.com","avatar":null},"body":"I had to rewrite history recently (ugh -- private repo, not shared with\nanybody) and wanted to change the commit message of the root commit.\nDuring this I've encountered a failing git-rebase if apply.whitespace is\nset to \"error\".\n\nShould whitespace-errors really be detected when rebasing?\n(or worse: be \"fixed\" without explicitely asking for it when using a\nglobal apply.whitespace=fix setting)\nWhat about making --ignore-whitespace the default for git-rebase?\n\n\nSimplified example:\n\n$ mkdir test\n$ cd test/\n$ git config apply.whitespace\nerror\n$ git init\nInitialized empty Git repository in /home/john/test/.git/\n$ git commit --allow-empty -m 'root commit'\n[master (root-commit) a208f9f] root commit\n$ echo ' ' > whitespace\n$ git add whitespace\n$ git commit -m 'add whitespace file'\n[master 12b685b] add whitespace file\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 whitespace\n$ git tag root a208f9f\n$ git checkout -b new-root root\nSwitched to a new branch 'new-root'\n$ git commit --amend --allow-empty -m 'changed root commit'\n[new-root b9adb89] changed root commit\n$ git checkout -\nSwitched to branch 'master'\n$ git rebase --onto new-root root\nFirst, rewinding head to replay your work on top of it...\nApplying: add whitespace file\nPatch failed at 0001 add whitespace file\n\nWhen you have resolved this problem run \"git rebase --continue\".\nIf you would prefer to skip this patch, instead run \"git rebase --skip\".\nTo restore the original branch and stop rebasing run \"git rebase --abort\".\n\n$ git diff\n$ git status\n$ git apply .git/rebase-apply/0001\n.git/rebase-apply/0001:17: trailing whitespace.\n\nfatal: 1 line adds whitespace errors.\n"},{"id":"125426","messageId":"7vpr8juei7.fsf@alter.siamese.dyndns.org","threadId":"21285","inReplyTo":"4ADCF6E9.8090704@feurix.com","subject":"Re: Rebase fails because of apply.whitespace setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-19T23:53:52Z","receivedAt":"2009-10-19T23:53:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Feuerstein <john@feurix.com> writes:\n\n> I had to rewrite history recently (ugh -- private repo, not shared with\n> anybody) and wanted to change the commit message of the root commit.\n> During this I've encountered a failing git-rebase if apply.whitespace is\n> set to \"error\".\n>\n> Should whitespace-errors really be detected when rebasing?\n> (or worse: be \"fixed\" without explicitely asking for it when using a\n> global apply.whitespace=fix setting)\n\nI've seen this argued both ways.  Some people seem to be happy that they\ncan use rebase with whitespace=fix to clean up their mess.  Some people\nquite rightly oppose it (I am slightly closer to the latter camp myself,\nbut that does not count that much).\n\nI'd agree that whitespace=error won't help anybody here.\n\nPerhaps rebase can be taught to take --whitespace=warn from the command\nline to override whatever is in the configuration?\n"}]}