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: melos version creates wrong workspace CHANGELOG.md entry on Windows due to CRLF #710

Open
1 task done
Gustl22 opened this issue Apr 29, 2024 · 2 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@Gustl22
Copy link

Gustl22 commented Apr 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Version

6.0.0

Description

melos version produces a new entry

# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

if the CHANGELOG.md is formatted in CRLF (like in Windows), although it's already existing.

Steps to reproduce

  1. Use a melos project.
  2. Open it up on Windows
  3. Make sure the CHANGELOG.md file is formatted as CRLF and not as LF in your preffered editor. This should be the standard behavior in Windows (at least for IntelliJ).
  4. run melos version

Expected behavior

Not have a dupe entry for

# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

Screenshots

No response

Additional context and comments

E.g. see https://github.com/bluefireteam/audioplayers/blob/main/CHANGELOG.md , see change.

@Gustl22 Gustl22 added the bug Something isn't working label Apr 29, 2024
@spydon
Copy link
Collaborator

spydon commented Jun 5, 2024

This only happens if you re-save the changelog file under windows right?

@Gustl22
Copy link
Author

Gustl22 commented Jun 5, 2024

It more depends on the git config
The default is:
git config core.autocrlf which means, on windows, code is automatically converted to CRLF, to provide compatibility with the system. On a commit, it is then converted to LF:
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows#global-settings-for-line-endings

So with the default git config, melos version is not working correctly due to the comparison. It should be a simple fix by replacing all the \r\n with \n before comparing, but I haven't gotten to it yet. I can post a PR when I have a free moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants