mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Use libgit2 with ssh-exec support
See https://github.com/libgit2/libgit2/pull/6617. This ensures that we get support for ~/.ssh/config, known_hosts etc.
This commit is contained in:
parent
cf59ea83ec
commit
21bb180547
3 changed files with 24 additions and 19 deletions
17
flake.lock
generated
17
flake.lock
generated
|
@ -16,6 +16,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libgit2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1697646580,
|
||||||
|
"narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=",
|
||||||
|
"owner": "libgit2",
|
||||||
|
"repo": "libgit2",
|
||||||
|
"rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "libgit2",
|
||||||
|
"repo": "libgit2",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"lowdown-src": {
|
"lowdown-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -67,6 +83,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
"libgit2": "libgit2",
|
||||||
"lowdown-src": "lowdown-src",
|
"lowdown-src": "lowdown-src",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-regression": "nixpkgs-regression"
|
"nixpkgs-regression": "nixpkgs-regression"
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||||
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
|
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
|
||||||
inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
||||||
|
inputs.libgit2 = { url = "github:libgit2/libgit2"; flake = false; };
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-regression, lowdown-src, flake-compat }:
|
outputs = { self, nixpkgs, nixpkgs-regression, lowdown-src, flake-compat, libgit2 }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
@ -194,7 +195,11 @@
|
||||||
bzip2 xz brotli editline
|
bzip2 xz brotli editline
|
||||||
openssl sqlite
|
openssl sqlite
|
||||||
libarchive
|
libarchive
|
||||||
libgit2
|
(pkgs.libgit2.overrideAttrs (attrs: {
|
||||||
|
src = libgit2;
|
||||||
|
version = libgit2.lastModifiedDate;
|
||||||
|
cmakeFlags = (attrs.cmakeFlags or []) ++ ["-DUSE_SSH=exec"];
|
||||||
|
}))
|
||||||
boost
|
boost
|
||||||
lowdown-nix
|
lowdown-nix
|
||||||
libsodium
|
libsodium
|
||||||
|
|
|
@ -336,9 +336,6 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::string & refspec) override
|
const std::string & refspec) override
|
||||||
{
|
{
|
||||||
/* FIXME: use libgit2. Unfortunately, it doesn't support
|
|
||||||
ssh_config at the moment. */
|
|
||||||
#if 0
|
|
||||||
Remote remote;
|
Remote remote;
|
||||||
|
|
||||||
if (git_remote_create_anonymous(Setter(remote), *this, url.c_str()))
|
if (git_remote_create_anonymous(Setter(remote), *this, url.c_str()))
|
||||||
|
@ -352,20 +349,6 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
||||||
|
|
||||||
if (git_remote_fetch(remote.get(), &refspecs2, nullptr, nullptr))
|
if (git_remote_fetch(remote.get(), &refspecs2, nullptr, nullptr))
|
||||||
throw Error("fetching '%s' from '%s': %s", refspec, url, git_error_last()->message);
|
throw Error("fetching '%s' from '%s': %s", refspec, url, git_error_last()->message);
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME: git stderr messes up our progress indicator, so
|
|
||||||
// we're using --quiet for now. Should process its stderr.
|
|
||||||
runProgram("git", true,
|
|
||||||
{ "-C", path.abs(),
|
|
||||||
"--bare",
|
|
||||||
"fetch",
|
|
||||||
"--quiet",
|
|
||||||
"--force",
|
|
||||||
"--",
|
|
||||||
url,
|
|
||||||
refspec
|
|
||||||
}, {}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyCommit(
|
void verifyCommit(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue