mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Fix Git LFS SSH issues
* Adds support for NIX_SSHOPTS * Properly uses the parsed port from URL (fixes #13337) * Don't guess the HTTP endpoint, use the response of git-lfs-authenticate * Add an SSH Git LFS test * Removed some unused test code
This commit is contained in:
parent
68839b9545
commit
ccf658ed5c
7 changed files with 128 additions and 85 deletions
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
Strings getNixSshOpts();
|
||||
|
||||
class SSHMaster
|
||||
{
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -51,6 +51,18 @@ static void checkValidAuthority(const ParsedURL::Authority & authority)
|
|||
}
|
||||
}
|
||||
|
||||
Strings getNixSshOpts()
|
||||
{
|
||||
std::string sshOpts = getEnv("NIX_SSHOPTS").value_or("");
|
||||
|
||||
try {
|
||||
return shellSplitString(sshOpts);
|
||||
} catch (Error & e) {
|
||||
e.addTrace({}, "while splitting NIX_SSHOPTS '%s'", sshOpts);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
SSHMaster::SSHMaster(
|
||||
const ParsedURL::Authority & authority,
|
||||
std::string_view keyFile,
|
||||
|
|
@ -82,16 +94,8 @@ void SSHMaster::addCommonSSHOpts(Strings & args)
|
|||
{
|
||||
auto state(state_.lock());
|
||||
|
||||
std::string sshOpts = getEnv("NIX_SSHOPTS").value_or("");
|
||||
|
||||
try {
|
||||
std::list<std::string> opts = shellSplitString(sshOpts);
|
||||
for (auto & i : opts)
|
||||
args.push_back(i);
|
||||
} catch (Error & e) {
|
||||
e.addTrace({}, "while splitting NIX_SSHOPTS '%s'", sshOpts);
|
||||
throw;
|
||||
}
|
||||
auto sshArgs = getNixSshOpts();
|
||||
args.insert(args.end(), sshArgs.begin(), sshArgs.end());
|
||||
|
||||
if (!keyFile.empty())
|
||||
args.insert(args.end(), {"-i", keyFile});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue