Skip to content

Conversation

@MiguelRoldao
Copy link

@MiguelRoldao MiguelRoldao commented Nov 11, 2025

Using micro on windows is very annoying, since the diff gutter will be filled with "modified", on git versioned files.

The diff in micro is calculated between the last commit in the repository and the active workspace. However, if the option core.autocrlf is enabled on windows, if the file in the repo has LF line endings, the file in the workspace will have CR LF line endings. Resulting in a detectable modification in every line of the file.

My solution checks if core.autocrlf is enabled. If it's not, if processes the diff normally. If it is enabled, the diff is calculated using git cat-file --filters, to filter out the line end changes.

This PR should solve issue #1517

@MiguelRoldao
Copy link
Author

This could possibly be simplified to a single:

shell.ExecCommand("git", "-C", dirName, "cat-file", "--filters", "HEAD:./" .. fileName)

But I'm not fluent in git to the extent of being able to guarantee that this would be equivalent to git show in all other cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant