crate2nix icon indicating copy to clipboard operation
crate2nix copied to clipboard

Master vs Main

Open JonathanLorimer opened this issue 4 years ago • 11 comments

Hello, there is an issue where (if a repo uses main instead of master) generatedCargoNix fails. The offending line is here https://github.com/kolloch/crate2nix/blob/master/tools.nix#L237. Unfortunately master is a sensible default given legacy repos, and main is sensible given github's new default naming schema. Perhaps we could allow the user to configure the default branch?

JonathanLorimer avatar Jul 16 '21 18:07 JonathanLorimer

https://github.com/kolloch/crate2nix/pull/206

I think this PR would solve the issue?

JonathanLorimer avatar Jul 16 '21 18:07 JonathanLorimer

Can you try and see if the feat/builtinfetchgit branch of https://github.com/yusdacra/crate2nix fixes the issue?

90-008 avatar Jul 21 '21 15:07 90-008

@yusdacra Oh yeah, this worked! Thank you!

JonathanLorimer avatar Jul 21 '21 15:07 JonathanLorimer

Also, switching to your branch seems to have resolved this issue https://github.com/kolloch/crate2nix/issues/207

JonathanLorimer avatar Jul 21 '21 16:07 JonathanLorimer

@yusdacra Oh yeah, this worked! Thank you!

That's good to hear. I've been meaning to make a PR for upstream, but that particular branch has so many changes and fixes it's kind of hard to :P

90-008 avatar Jul 21 '21 16:07 90-008

I did also notice this warning. Not sure if its helpful.

trace: warning: crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead.

JonathanLorimer avatar Jul 21 '21 16:07 JonathanLorimer

I think it would be very worthwhile to get your branch merged. Especially since crate2nix is looking to release a verion 1.0

JonathanLorimer avatar Jul 21 '21 16:07 JonathanLorimer

There's two branches being discussed here, the PR and the other one. Which is preferred? I am not sure I've encountered tools.nix yet -- so I am not really sure what is going on.

Ericson2314 avatar Oct 12 '21 17:10 Ericson2314

Using master as the name of the default branch was always only a convention and I have encountered varied opinions and alternative conventions in the past. It is not just master vs. main; right now I am working in an organisation that takes the stance: "the tip of the repo contains the latest developments; we call it develop." I've met SVN die-hards that straight up call it trunk. GitHub is leading the charge and setting a new trend with main. The fact is that all are valid and, in this day and age, your likely to encounter a mix of more than just one. Therefore no fallback value will fit all scenarios; it doesn't matter if I can override the fallback value or not (i.e. some repos will need master, others main, yet more others something else!) The fetchGit function is capable of making the decision itself (i.e. ref = null;).

au-phiware avatar Dec 07 '21 11:12 au-phiware

The fetchGit function is capable of making the decision itself (i.e. ref = null;).

Yeah the remote-side HEAD symref is the gold standard here.

Ericson2314 avatar Dec 07 '21 15:12 Ericson2314

What's the recommended workaround? Forking and s/master/HEAD seems to work, but this is rather inelegant.

DieracDelta avatar Mar 22 '22 13:03 DieracDelta