Failed to fix eol space issue in git

I have a guthub repository that is fork fluentmigrator . This was my first git raid, and I got into a situation in which I cannot clear up some conflicts between spaces between my fork and the upstream repository.

I start on Windows 7 and use the msysgit client. Here are the related 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 registry and has some changes regarding the upstream repository

 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(-) 

Changes to some of these files are pure EOL issues. If I look at diff for src/FluentMigrator.Console/MigratorConsole.cs and ignore spaces.

 $ 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 tried to fix this problem by following the tips for configuring core.autocrlf from various SO answers, but nothing seems to put me in a state where my file is updated and shows diff against my origin , but matches upstream .

Here is what I have tried.

Install 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 convert manually using 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 at the end of each inserted line in diff there are ^M characters, for example.

 + public string Group;^M 

Setting git config core.whitespace cr-at-eol showed that diff looks right, however, I'm afraid that if I commit this file, I will still put incompatible whitespace in the repo.

I am trying to fix my plug for a transfer request, so any advice in general to solve this problem is welcome.

+4
source share
1 answer

I would completely repeat the local clone:

  • git config --global core.autocrlf=false
  • git clone https://github.com/lscharen/fluentmigrator

In short, no EOL conversion should happen in the first place, and you should have dos2unix all your files right now.

+1
source

Source: https://habr.com/ru/post/1413252/


All Articles