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

fetchgit: extraConfig, allowing extra git configuration. #49569

Closed

Conversation

TravisWhitaker
Copy link
Contributor

Motivation for this change

This adds an extra parameter extraConfig to fetchgit, allowing extra contents to be appended to .git/config before fetching. This is useful in some circumstances; in particular I added this because I'm using an upstream repo that requires [url "..."] sections in my local git config for submodules to be cloned correctly.

This shouldn't impact any of the existing fetchgit call sites, but is something others may find useful.

I'm no expert on the caveats of bash, so I'm not sure if there's a safer/better way to append to the config.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@puffnfresh puffnfresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems useful!

@TravisWhitaker
Copy link
Contributor Author

Any reason to not merge this?

@TravisWhitaker
Copy link
Contributor Author

What is required for this to be merged?

@TravisWhitaker
Copy link
Contributor Author

@puffnfresh Any thoughts on what it'll take to get this merged?

@@ -20,6 +20,8 @@ in
# successfully. This can do things like check or transform the file.
postFetch ? ""
, preferLocalBuild ? true
, # Extra configuration appended to the repo's local configuration file.
extraConfig ? ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraConfig is a bit vague. Perhaps extraGitConfig would be better?

Copy link
Member

@veprbl veprbl May 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also makes sense to put it above postFetch ? "".

@@ -207,6 +207,9 @@ clone(){
# Initialize the repository.
init_remote "$url"

# Append extra config.
echo "${extraConfig}" >> .git/config
Copy link
Member

@veprbl veprbl May 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break if extraConfig contains special characters like ". Perhaps a safer way is to write your string to a path in the store using builtins.toFile and then use "cat" to read that file instead of trying to "echo" the string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch that. This is not inside nix, but just in the shell. You need to drop the curly braces as they are not used in our shell scripts.

@veprbl
Copy link
Member

veprbl commented May 29, 2019

@TravisWhitaker Also could you provide an example of how you use it? If the repo is private and is inaccessible for testing that's fine. I think that would help with seeing how the option you introduce is helpful and flexible.

@veprbl
Copy link
Member

veprbl commented Dec 27, 2019

@TravisWhitaker Are you still interested in finishing this?

@stale
Copy link

stale bot commented Jun 24, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 24, 2020
@TravisWhitaker
Copy link
Contributor Author

I've moved to builtins.fetchGit and no longer need this feature (and it seems no one else needs it, either).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: fetch 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants