libgit2 / libgit2/libgit2sharp

"invalid version 0 on git_proxy_options" thrown when natives are built from source

Open
#2,161 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm currently trying to make a custom build that uses libssh2 instead of exec for SSH, since I don't want OpenSSH windows to spawn as my program makes requests. I changed this flag, then followed through the rest of the compilation steps both for native binaries and lg2s.

I then tried pulling, not on a proxy, using this code:

var fOptions = new FetchOptions ();
fOptions.Prune = UpdaterMod.settings.pruneOld;

var mOptions = new MergeOptions ();
mOptions.CommitOnSuccess = true;
mOptions.FileConflictStrategy = UpdaterMod.settings.onFileConflict;

var sig = new Signature (new Identity (modName, email), DateTimeOffset.Now);

try {
    string logHolder = "";
    Commands.Fetch (repo, remote.Name, refSpecs, fOptions, logHolder);

    if (logHolder.Length > 0)
        LogMsg (logHolder, LogMode.Warn);
}
catch (Exception e) {
    LogMsg ($"Could not fetch data from remote repo: {e.Message}", LogMode.Error);
    return;
}

Expected behavior

The program should attempt to pull without trying to use a proxy.

Actual behavior

The caught exception contains the message in the title.

System information

Windows 10 10.0.19045

AMD Ryzen 5 3600

Other useful information

This issue persists when the flag is switched back to exec

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Commands.Fetch call with FetchOptions on the reported Windows build, then trace how the native build handles proxy options and version validation. Reproduce the fetch with the custom and exec configurations; done means a non-proxy fetch no longer throws the reported invalid-version exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.