5

After cloning this repo:

https://github.com/OpenFOAM/OpenFOAM-3.0.x

I immediately have changes to be committed. I've tried to fix it using the common solution of changing textmode and crlfauto on the ./git/config file. I've also tried the .gitattributes file. However, this is not a line endings issue. I have actual changes in the code.

Here is my procedure and output:

cruz@MacBook-Air-de-Luis  ~/dev  git clone https://github.com/luiscruz/OpenFOAM-3.0.x.git
Cloning into 'OpenFOAM-3.0.x'...
remote: Counting objects: 49097, done.
remote: Total 49097 (delta 0), reused 0 (delta 0), pack-reused 49097
Receiving objects: 100% (49097/49097), 59.70 MiB | 2.29 MiB/s, done.
Resolving deltas: 100% (30768/30768), done.
Checking connectivity... done.
Checking out files: 100% (13863/13863), done.
 cruz@MacBook-Air-de-Luis  ~/dev  cd OpenFOAM-3.0.x
 cruz@MacBook-Air-de-Luis  ~/dev/OpenFOAM-3.0.x   master ●  git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/InterfaceCompositionModel/InterfaceCompositionModel.C
    modified:   applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/InterfaceCompositionModel/InterfaceCompositionModel.H
    modified:   applications/test/Dictionary/Make/files
    modified:   applications/test/Dictionary/Make/options
    modified:   applications/test/Dictionary/Test-Dictionary.C
    modified:   src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.H
    modified:   src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixPreconditioner.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSmoother.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C
    modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H
    modified:   src/OpenFOAM/matrices/LduMatrix/Preconditioners/DiagonalPreconditioner/DiagonalPreconditioner.C
    modified:   src/OpenFOAM/matrices/LduMatrix/Preconditioners/DiagonalPreconditioner/DiagonalPreconditioner.H
    modified:   src/OpenFOAM/matrices/LduMatrix/Preconditioners/NoPreconditioner/NoPreconditioner.C
    modified:   src/OpenFOAM/matrices/LduMatrix/Preconditioners/NoPreconditioner/NoPreconditioner.H
    modified:   src/OpenFOAM/matrices/LduMatrix/Solvers/DiagonalSolver/DiagonalSolver.C
    modified:   src/OpenFOAM/matrices/LduMatrix/Solvers/DiagonalSolver/DiagonalSolver.H
    modified:   src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C
    modified:   src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.H
    modified:   src/OpenFOAM/meshes/MeshObject/MeshObject.C
    modified:   src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
    modified:   src/OpenFOAM/meshes/primitiveShapes/objectHit/PointHit.H
    modified:   src/OpenFOAM/meshes/primitiveShapes/objectHit/PointIndexHit.H
    modified:   src/finiteVolume/finiteVolume/fvc/fvcDDt.C
    modified:   src/finiteVolume/finiteVolume/fvc/fvcDDt.H
    modified:   src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C
    modified:   src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H
    modified:   src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrads.C
    modified:   src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C
    modified:   src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H
    modified:   src/fvOptions/constraints/general/explicitSetValue/ExplicitSetValue.C
    modified:   src/fvOptions/sources/general/codedSource/CodedSource.C
    modified:   src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C
    modified:   tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0.org/B

no changes added to commit (use "git add" and/or "git commit -a")
 cruz@MacBook-Air-de-Luis  ~/dev/OpenFOAM-3.0.x   master ● 

I have even tried to commit those changes, but it does not work.

git version 2.10.1 Mac OS X 10.10.5

My git config:

git config -l
core.excludesfile=~/.gitignore
core.legacyheaders=false
core.quotepath=false
core.pager=less
mergetool.keepbackup=true
push.default=simple
color.ui=auto
color.interactive=auto
repack.usedeltabaseoffset=true
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
alias.ll=log --stat --abbrev-commit
alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
alias.d=diff
alias.master=checkout master
alias.spull=svn rebase
alias.spush=svn dcommit
alias.alias=!git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\     => \2/' | sort
include.path=~/.gitcinclude
include.path=.githubconfig
include.path=.gitcredential
diff.exif.textconv=exif
credential.helper=osxkeychain
user.name=Luis Cruz
user.email=luismirandacruz@gmail.com
credential.helper=osxkeychain
push.default=simple
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.autocrlf=true
remote.origin.url=https://github.com/luiscruz/OpenFOAM-3.0.x.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

git diff excerpt:

-#include "InterfaceCompositionModel.H"
+#include "interfaceCompositionModel.H"
 #include "phaseModel.H"
 #include "phasePair.H"
-#include "pureMixture.H"
-#include "multiComponentMixture.H"
-#include "rhoThermo.H"

-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

I invite you to clone the repo:

 git clone https://github.com/luiscruz/OpenFOAM-3.0.x.git
max630
  • 8,762
  • 3
  • 30
  • 55
Luis Cruz
  • 393
  • 1
  • 14
  • My guess is that it is related to the way you define the EOL of git locally on your machine. Can you add details such as the output of *git config -l* and what OS you have? – yorammi Dec 09 '16 at 10:07
  • I've just edited the question with your request, @yorammi – Luis Cruz Dec 09 '16 at 10:20
  • There may be an issue with core.ignorecase=true core.precomposeunicode=true core.autocrlf=true especially the ignorecase one – yorammi Dec 09 '16 at 13:30
  • I've changed each of them using something like ```git config core.precomposeunicode false``` and the problem persists... – Luis Cruz Dec 09 '16 at 17:58
  • After the change, did you clone again? – yorammi Dec 10 '16 at 07:39
  • Could you check what `git diff` prints for the reported files? – max630 Dec 12 '16 at 08:05
  • @yorammi yes, at the time you commented I haven't, but I just did and the problem persists – Luis Cruz Dec 12 '16 at 10:20
  • @max630 I've just edited the question with a portion of a diff. Note that I haven't changed anything. This is after a fresh clone of the repo. – Luis Cruz Dec 12 '16 at 10:24
  • 1
    Something indeed is wrong with this repository. I did also a git clone of it and got the modified files without being able to get rid of those changes. Seems like some kind of hook there. I'll try to solve it and let you know – yorammi Dec 12 '16 at 11:03
  • I've checked it on several OS (Mac, Windows, Ubuntu) and with all combinations of ignorecase and autocrlf and it still fails. If you look deeply into all the differences you'll see that it is not just an issue of case (lower/upper case) but also that there are additional or removed header files lines. Seems to be that something is totally wrong with the original repository in the .git folder – yorammi Dec 13 '16 at 13:55
  • Similar issue here: http://stackoverflow.com/questions/5009096/files-showing-as-modified-directly-after-git-clone – Eddie Chen - MSFT Dec 14 '16 at 03:22

2 Answers2

0

This link may can help you, Git refuses to reset/discard files

It's mainly cause different Line Feed for Mac, Liunx and Windows.

Community
  • 1
  • 1
Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • I should not need to commit or add anything. When I clone a repo I should get a repo without any changes to be commit. – Luis Cruz Dec 12 '16 at 10:21
  • Ok, got it. Sorry for misunderstanding. so you can try `git config --global core.autocrlf input` – Marina Liu Dec 13 '16 at 08:46
  • @LuisCruz, I just updated my answer and shared a link which maybe help you. Please check if it's can solve your problem. – Marina Liu Dec 14 '16 at 06:53
  • I checked the link and it seems to be related with a problem in line endings. It's not the case with this repo, as you can see from the diff excerpt. Anyway, I've tried the suggested fix and it did not fix the issue. – Luis Cruz Dec 14 '16 at 16:12
0

Compare https://github.com/OpenFOAM/OpenFOAM-3.0.x/blob/master/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H and https://github.com/OpenFOAM/OpenFOAM-3.0.x/blob/master/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H

These are 2 files which paths differ only in case. Your MacOsX most probably has case-insensitive filesystem which messes them together.

From how they look I would say it was not intentional, but because of some mistake. There are some options to try to recover from it, but I would suggest first checking the official repository: http://www.openfoam.com/code/repositories.php and see it if has same issue.

max630
  • 8,762
  • 3
  • 30
  • 55
  • The repo I've mentioned is a clean fork of the official repo: [https://github.com/OpenFOAM/OpenFOAM-3.0.x](https://github.com/OpenFOAM/OpenFOAM-3.0.x) What options do you recommend to recover from it? – Luis Cruz Dec 12 '16 at 11:38
  • Official repo is not the one at github. Check that first – max630 Dec 12 '16 at 11:39
  • If you have to work with this repository, you should skip the conflicting directories from checkout as described here: https://stackoverflow.com/a/25023912/2303202 . Maybe you will have to set up `core.ignorecase` to `false` to make sparse checkout consider case. Though I'm not sure. – max630 Dec 12 '16 at 11:47
  • This is not the case here. I've checked it on several OS (Mac, Windows, Ubuntu) and with all combinations of ignorecase and autocrlf and it still fails. If you look deeply into all the differences you'll see that it is not just an issue of case (lower/upper case) but also that there are additional or removed header files lines. Seems to be that something is totally wrong with the original repository in the .git folder. – yorammi Dec 13 '16 at 13:55
  • @yorammi I don't confirm it. Have cloned `master` of the [original repository](https://github.com/OpenFOAM/OpenFOAM-3.0.x) and it does not contain any changes. Debian wheezy, ext4 partition, tried with 2 versions of git: some 2.3.* and 2.10.1, with no case-insensitivity stuff in config (more or less the default one). In Mac in Windows I guess you will have the changes. I don't know why you have seen changes in Ubuntu. Maybe you somehow run it at case-insensitive partition. – max630 Dec 14 '16 at 04:59