LibGit2Sharp.LibGit2SharpException, additional info code and category changed to int

Open
#1,358 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp, git
Domain
backend

Research direction

Open LibGit2Sharp/LibGit2SharpException.cs and inspect lines 58-59, where the libgit2 code and category enums are cast to int for additional information. Replace the numeric output with the corresponding enum values, then verify that exception data displays readable enum names instead of integers.

Written by the indexing model from the issue text.

Description

The following is taken from a log file:

LibGit2Sharp.LibGit2SharpException: Failed to map 'false?'
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_checkout_tree(RepositorySafeHandle repo, ObjectId treeId, GitCheckoutOpts& opts)
at LibGit2Sharp.Repository.CheckoutTree(Tree tree, IList`1 paths, IConvertableToGitCheckoutOpts opts)
at LibGit2Sharp.Repository.Checkout(Tree tree, CheckoutOptions checkoutOptions, String refLogHeadSpec)
at LibGit2Sharp.Repository.Checkout(Branch branch, CheckoutOptions options)
Additional Data:
libgit2.code: -1
libgit2.category: 7

As you can see, both code and category are numbers here. But internally they are enums, it would be a lot easier to read this if the enums where used in the additional info, instead of the int.

LibGit2Sharp/LibGit2SharpException.cs
affected lines 58,59, where the enum is cast to int.

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

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.

More from libgit2/libgit2sharp

All issues in libgit2/libgit2sharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.