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 marked as *modified after clone

See original GitHub issue

I am using Node, on Windows

Problem

On Windows and with some repositories, isogit is telling me that all files are modified just after cloning the repo.

This is blocking me because I can’t find which files have been changed locally since the last commit

Steps to reproduce

npm i -g isomorphic-git
git clone https://github.com/acailly/isomorphic-git-issue-1275.git
cd isomorphic-git-issue-1275
isogit status --filepath="README.md"
> "*modified"

This is not reproduced on other repo like https://github.com/isomorphic-git/isomorphic-git.git

I do not reproduce it on the Ubuntu executed in WSL2 (Windows Subsystem for Linux), where the displayed status is correct (unmodified )

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
acaillycommented, Dec 13, 2020

I confirm this is a crlf issue, if I change GitObject.wrap implementation from

https://github.com/isomorphic-git/isomorphic-git/blob/f2e38053733f4c8ca4b7784d5c2a56addcf36bf4/src/models/GitObject.js#L4

to

class GitObject {
  static wrap({ type, object }) {
    // This is a quick and dirty fix
    const objectWithoutCRLF = Buffer.from(object.toString("utf8")
      .replace(new RegExp("\x0D\x0A", 'g'), "\x0A"))

    return Buffer.concat([
      Buffer.from(`${type} ${objectWithoutCRLF.byteLength.toString()}\x00`),
      Buffer.from(objectWithoutCRLF),
    ])
  }

then the bug disapeared \o/

I tried to set the core.autocrlf git config to false and the bug disapeared too (even without the fix) But I want to keep it to true since I often work with people on Linux (including me)

so it seems that line break issues are not handled in isomorphic-git and I don’t find any related issues, is it possible that I am the only one using this lib on Windows ? 😁 or maybe I am missing something, which is very possible

0reactions
acaillycommented, Jun 28, 2021

My fix is a workaround oustide this repo and specific to my use case, so I don’t really have a good fix to submit

Read more comments on GitHub >

github_iconTop Results From Across the Web

Files showing as modified directly after a Git clone
This was caused by the path to the file and the filename being too long for Windows. To resolve it, clone the repository...
Read more >
git status shows as files modified directly after clones
The behavior which showing some files as modified could be related to line ending setting and multiple client used. Every operating system ...
Read more >
Files showing as modified directly after a Git clone - Intellipaat
For this problem try: git config --global core.autocrlf input. Even then if it was showing the files are changed then:.
Read more >
Some git-lfs tracked files shown as modified after git clone
The diff you've shown indicates that the files share the same mode but have different contents and at least one set of contents...
Read more >
Use Git in MATLAB - MATLAB & Simulink - MathWorks
Clone Remote Git Repository · Mark Files for Addition · Review Changes · Commit Modified Files · Push Files · Resolve Conflicts ·...
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