libgit2 / libgit2/libgit2sharp

Ensure.HandleError does not set GitErrorCategory.

Open
#1,840 0 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

Reproduction steps

This reproduces with any error handled by Ensure.HandleError, but my exact repro steps are:

  1. Clone repository
  2. Commit
  3. Push with credentials that have only read permissions to the repo.

Looking at the error message, the error appears to be thrown from here.

Expected behavior

Exception is thrown and the ex.Data["libgit2.category"] is set to a proper value. In my case it would be GitErrorCategory.Net.

Actual behavior

Exception is thrown, but the ex.Data["libgit2.category"] has value -1.

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Windows 10 1909; NET 4.6.1

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 in LibGit2Sharp/Core/Ensure.cs at Ensure.HandleError and compare the native error path named in libgit2's src/transports/winhttp.c. Reproduce the read-only push on Windows and inspect how the exception's ex.Data["libgit2.category"] is assigned. Done means this path reports GitErrorCategory.Net instead of -1.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.