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

feat!(Paket.restore.targets): Support dotnet restore without paket restore; avoid null git diffs #4231

Open
bartelink opened this issue Oct 16, 2023 · 0 comments

Comments

@bartelink
Copy link
Member

bartelink commented Oct 16, 2023

Context

  • Paket referenced via dotnet.tools.json (v 7.2.1); same version spec in paket.dependencies
  • per what I believe to be common practice, I specify * text=auto in .gitattributes; 99% of files are thus LF endings

Description

The paket docs don't provide a pit of success for the combo of:

  • using git
  • being able to dotnet restore or dotnet build from a clean clone (or git clean -fdx)
  • NOT having to run dotnet paket restore (as dotnet restore seems to include it and Just Work as long a the Paket.restore.targets file is present)

Expected behavior

  • Never end up with line-ending only diffs in git
  • Never have to invoke paket restore

Actual behavior

  1. If/when I edit/merge Paket.restore.targets, the line endings change to LF
  2. If/when I paket install etc, the file is replaced with a CRLF-endings based file
  3. If I don't commit `Paket.restore.targets, restore does not work without a paket restore

Desired behavior/crazy ideas

I'd be very happy to be told about the xyproblem.info nature of my reasoning and told a better solution, but I feel I've definitely done the legwork to try to figure this out!

I see the following potential general directions to resolve the issue:

  1. Add a doc section that covers what to do (atm it has many generations of advice, but nothing that suggests that it's currently a good idea to add Paket.restore.targets to your repo). I would propose to add some version of the Known Workarounds below to the docs.
  2. Tweak Paket's behavior in minor ways. e.g.
    • if it figured out the expected line endings and wrote paket.restore.targets per that ?
    • if paket autorestore printed a message recommending to commit the Paket.restore.targets ?
  3. Do a more complete fix or V8, e.g.
  • Have a /paket.targets in base of repo (with line endings per .gitattributes)
  • Update the docs to say to commit /paket.*
  • Either have Paket autorestore put a CRLF override in the .gitattributes, or respect the repo's rules

I'd be prepared to do solution 1 if I get enough input

I am not sufficiently au fait with current gen paket to do solution 2

I don't realistically have bandwidth to contribute to the impl of solution 3, though I'll obviously test and type here.

Known workarounds

(Assuming typical gitattributes with typical * text=auto in effect)

  1. Add .paket/Paket.restore.targets eol=crlf to .gitattributes
  2. Add .paket/Paket.restore.targets to source control (with CRLF line endings)
@bartelink bartelink changed the title feat!(Paket.restore.targets): Don't trigger null diffs feat!(Paket.restore.targets): Support dotnet restore without paket restore; avoid null git diffs Oct 16, 2023
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

No branches or pull requests

1 participant