Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle non utf8 files with autocrlf correctly #1909

Merged
merged 4 commits into from May 7, 2024

Conversation

jayree
Copy link
Contributor

@jayree jayree commented May 5, 2024

fix #1908

@jcubic
Copy link
Contributor

jcubic commented May 5, 2024

Can you add a unit test for this?

@jayree
Copy link
Contributor Author

jayree commented May 5, 2024

@jcubic I tried, but I don't know how to create a new fixture with a binary file included.

@jcubic
Copy link
Contributor

jcubic commented May 6, 2024

You can try to include files that contain \r and different files that changed. When adding all of them, only files that changed should be in the staging area by statusMatrix. It can be a test for StatusMatrix.

@jayree
Copy link
Contributor Author

jayree commented May 6, 2024

@jcubic the problem is not the test case, I'm unable to create a new working fixture repository. If I include the index the workdir is empty. If I remove the index all files have the status *added

@jcubic
Copy link
Contributor

jcubic commented May 6, 2024

I will check later today on how to create fixures.

@jayree
Copy link
Contributor Author

jayree commented May 6, 2024

@jcubic I think I've found a way!

@jayree jayree force-pushed the fix-1908 branch 2 times, most recently from 051895b to 74d45db Compare May 6, 2024 11:50
@jcubic
Copy link
Contributor

jcubic commented May 6, 2024

Are those hooks even used? It looks like sample code created by git init. Can you remove them?

@jayree jayree force-pushed the fix-1908 branch 3 times, most recently from 6c256ed to 219c988 Compare May 6, 2024 15:15
@jcubic
Copy link
Contributor

jcubic commented May 6, 2024

The tests are failing, it throws a wrong error.

Expected 'UnmergedPathsError' to be 'MergeConflictError'.
    at <Jasmine>
    at UserContext.<anonymous> (__tests__/index.webpack.js:2430:24)

@jayree
Copy link
Contributor Author

jayree commented May 6, 2024

@jcubic looks like a framework/devops issue. 2nd run was ok

@jayree
Copy link
Contributor Author

jayree commented May 7, 2024

@jcubic Is anything else missing?

@jayree jayree changed the title Fix 1908 fix: handle non utf8 files with autocrlf correctly May 7, 2024
@jcubic
Copy link
Contributor

jcubic commented May 7, 2024

I would add yet another test, to make sure that normal text files with \r that don't change also are not marked as modified. You can copy and paste the test and use a normal text file instead of a binary file.

@jayree
Copy link
Contributor Author

jayree commented May 7, 2024

@jcubic done

@jcubic jcubic merged commit 79e29d0 into isomorphic-git:main May 7, 2024
5 checks passed
@isomorphic-git-bot
Copy link
Member

🎉 This PR is included in version 1.25.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unchanged image/audio files being queued for commit with git.add()
3 participants