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: init script line endings #3178

Merged
merged 1 commit into from
Oct 30, 2021
Merged

Conversation

mdonoughe
Copy link
Contributor

@mdonoughe mdonoughe commented Oct 25, 2021

Description

The .gitattributes file says /src/init/ text eol=lf, which applies the text eol=lf only to the directory, not to the files in the directory.

$ git check-attr -a src/init/starship.zsh

(no output)

By changing the rule to /src/init/* text eol=lf, it is applied to all files within the directory instead.

$ git check-attr -a src/init/starship.zsh
src/init/starship.zsh: text: set
src/init/starship.zsh: eol: lf

Motivation and Context

Closes #3099

How Has This Been Tested?

  • I have tested using MacOS
  • I have tested using Linux
  • I have tested using Windows

I don't actually have zsh on Windows, but I can see the problem using xxd.

Before:

$ starship init zsh --print-full-init | xxd | tail -n 1
00001180: 4253 5f43 4f55 4e54 2229 270d 0a         BS_COUNT")'..

(note the 0d 0a sequence at the end)

After changing .gitattributes and doing a clean checkout of the init directory:

$ starship init zsh --print-full-init | xxd | tail -n 1
00001190: 4253 5f43 4f55 4e54 2229 270a 0a         BS_COUNT")'..

(now it's 0a 0a. The second 0a was introduced two weeks ago. The before test was with the release version so the second line feed was not present.)

Since this also applies to starship.ps1 I checked on Windows PowerShell 5.1 and PowerShell 7.1 (on Windows) and neither seem to care about the missing carriage returns.

On Linux and OS X, I expect the files have always had LF line endings and this change has no impact because that's the default behavior when checking out Git repositories on non-Windows build machines.

Checklist:

  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@mdonoughe mdonoughe changed the title Fix init script line endings fix: init script line endings Oct 25, 2021
@andytom andytom merged commit 265b92b into starship:master Oct 30, 2021
@andytom
Copy link
Member

andytom commented Oct 30, 2021

Thank you for your contribution @mdonoughe and thanks for reviewing @davidkna.

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.

Unable to load Starship using the init command in zsh for msys on Windows
3 participants