Reputation: 8133
I have a repository on guthub that is a fork of fluentmigrator. This was my first foray into git and I've gotten myself into a situation which I am unable to clean up some whitespace conflicts between my fork and the upstream repository.
I am running on Windows 7 and am using the msysgit client. Here are the linked repositories
$ git remote -v
origin https://github.com/lscharen/fluentmigrator (fetch)
origin https://github.com/lscharen/fluentmigrator (push)
upstream http://www.github.com/schambers/fluentmigrator (fetch)
upstream http://www.github.com/schambers/fluentmigrator (push)
My local repo is current with my github repo and has some changes against the upstream repo
lscharen@LSCHAREN01 /c/checkout/fluentmigrator (master)
$ git diff --stat origin/master
lscharen@LSCHAREN01 /c/checkout/fluentmigrator (master)
$ git diff --stat upstream/master
src/FluentMigrator.Console/MigratorConsole.cs | 563 ++++++++++----------
.../Initialization/IRunnerContext.cs | 1 +
.../Initialization/RunnerContext.cs | 1 +
src/FluentMigrator.Runner/MigrationLoader.cs | 193 ++++----
src/FluentMigrator.Runner/MigrationRunner.cs | 4 +-
src/FluentMigrator.Runner/VersionLoader.cs | 343 +++++++------
.../Versioning/VersionMigration.cs | 221 +++++----
.../Unit/TestVersionTableMetaData.cs | 105 ++--
.../Unit/VersionLoaderTests.cs | 272 +++++-----
.../Infrastructure/DefaultMigrationConventions.cs | 252 +++++-----
.../Infrastructure/MigrationMetadata.cs | 91 ++--
src/FluentMigrator/MigrationAttribute.cs | 70 ++--
.../DefaultVersionTableMetaData.cs | 84 ++--
.../VersionTableInfo/IVersionTableMetaData.cs | 57 ++-
14 files changed, 1182 insertions(+), 1075 deletions(-)
The changes in some of these files are pure EOL issues. If I look at the diff for src/FluentMigrator.Console/MigratorConsole.cs
and ignore whitespace.
$ git diff --stat -w upstream/master src/FluentMigrator.Console/MigratorConsole.cs
src/FluentMigrator.Console/MigratorConsole.cs | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
I've attempted to fix the problem by following the advice on setting core.autocrlf
from various SO answers, but nothing seems to put me in a state where my file is updated and shows a diff against my origin
, but matches the upstream
.
Here is what I've tried.
Set core.autocrlf input
from this answer
$ git rm --cached src/FluentMigrator.Console/MigratorConsole.cs
rm 'src/FluentMigrator.Console/MigratorConsole.cs'
$ git config core.autocrlf input
$ git add src/FluentMigrator.Console/MigratorConsole.cs
$ git diff --stat upstream/master src/FluentMigrator.Console/MigratorConsole.cs
src/FluentMigrator.Console/MigratorConsole.cs | 563 +++++++++++++------------
1 files changed, 287 insertions(+), 276 deletions(-)
Set core.autocrlf false
and manually convert with dos2unix
$ git config core.autocrlf false
$ dos2unix src/FluentMigrator.Console/MigratorConsole.cs
$ git diff --stat upstream/master src/FluentMigrator.Console/MigratorConsole.cs
src/FluentMigrator.Console/MigratorConsole.cs | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
Close! But there are hanging ^M
characters at the end of each inserted line in the diff, e.g.
+ public string Group;^M
Setting git config core.whitespace cr-at-eol
made the diff
look correct, however I'm afraid that if I commit this file that I'll still be putting incompatible whitespace characters into the repo.
I'm trying to fix up my fork for a pull request, so any advice in general for dealing with this issue is appreciated.
Upvotes: 4
Views: 396
Reputation: 1326872
I would redo the local clone entirely by:
git config --global core.autocrlf=false
git clone https://github.com/lscharen/fluentmigrator
In short, no EOL conversion should have taken place in the first place, and you should been dos2unix
all your files right now.
Upvotes: 1