question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Files reported as modified but are binary equal

See original GitHub issue

I’m having an issue with Repository.RetrieveStatus(). It is reporting several files as modified when they are binary equal to what is committed.

There are no local changes.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

Auto CRLF is set to false. (It is globally set to true but locally it’s set to false)

$ git config --local -l
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
core.autocrlf=false

There is no .gitattributes file.

I’m using LibGit2Sharp 0.21.0.176. The following code shows several files as modified.

var repo = new Repository(path);

var files =
    from f in repo.RetrieveStatus()
    where f.State != FileStatus.Ignored &&
          f.State != FileStatus.Untracked
    select f;

foreach (var file in files)
{
    Console.WriteLine($"{file.State}\t{file.FilePath}");
}

Why is RetrieveStatus() reporting modifications when git status does not?

Let me know if there’s anything I can do to get you any other information you need to help diagnose the problem.

James

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
whoisjcommented, Dec 15, 2015

autocrlf is pure evil 👿 . I highly recommend disabling it all together, everywhere and rely on .gitattributes solely. If your workplace or development team don’t follow, explain to them the error of their ways until they do. 😉

That said, @ethomson is likely correct that you were bitten by autocrlf during the initial clone. Though, since .gitattributes is a priority file I am surprised.

0reactions
ethomsoncommented, Mar 4, 2016

LibGit2Sharp v0.22 has been released, which includes compatibility with Git 2.x (which uses nanosecond timestamp resolution). This confused us, and we ended up more aggressively examining the working tree for changes, which would show mismatches between configured line endings and the actual files in the repository as changes. This should now be resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Binary equal files show as modified, unable to revert
I suddenly have a few files that show as modified, but KDiff says they are binary equal. Reverting and discarding those changes does...
Read more >
Binary Compare says there are differences when ... - Forums
The Binary compare is accurate. It compares the file bit by bit, even invisible metadata information (which Excel often stores and changes).
Read more >
Bug folder compare:Why are some files show binary equal ...
I performed a folder compare of two large folder trees with the Session settings in the attached snapshot. I enabled "Diffs" icon in...
Read more >
Git - git-diff Documentation
git-diff - Show changes between commits, commit and working tree, etc ... For binary files, outputs two - instead of saying 0 0...
Read more >
filecmp — File and Directory Comparisons
The filecmp module defines functions to compare files and directories, with various optional time/correctness trade-offs. For comparing files, see also the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found