libgit2 / libgit2/libgit2sharp

GitRepository.Config.BuildSignature throws an exception if user.name contains whitespace

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

For some reason I haven't yet figured out, my user.name setting is ' ' (a single whitespace). When I try to call GitRepository.Config.BuildSignature, it throws an exception instead of returning null

Reproduction steps
  • Set your user.name setting to whitespace
using(var repo = new GitRepository(workingDirectory))
{
    var signature = repo.Config.BuildSignature(DateTimeOffset.Now);
}
Expected behavior

Return null

Actual behavior

Throws System.ArgumentException: 'String cannot be empty Parameter name: name'

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Windows 10,

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 GitRepository.Config.BuildSignature and reproduce the issue with a user.name value containing only whitespace. Verify that the method returns null rather than throwing System.ArgumentException when the whitespace name is encountered.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.