Skip to content

Commit 40d16d7

Browse files
committed
Merge pull request #745 from ckuhn203/gitconfigfix
Hotfix for #722
2 parents 90788f8 + f7166e1 commit 40d16d7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Rubberduck.SourceControl/GitProvider.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,17 @@ public override IRepository InitVBAProject(string directory)
152152
repo.Stage(stat.FilePath);
153153
}
154154

155-
repo.Commit("Intial Commit");
155+
try
156+
{
157+
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
158+
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
159+
// so we pass a signature that won't throw along to the commit.
160+
repo.Commit("Intial Commit", GetSignature());
161+
}
162+
catch(LibGit2SharpException ex)
163+
{
164+
throw new SourceControlException("Unable to perform intial commit.", ex);
165+
}
156166
}
157167

158168
return repository;
@@ -240,7 +250,10 @@ public override void Commit(string message)
240250
{
241251
try
242252
{
243-
_repo.Commit(message);
253+
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
254+
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
255+
// so we pass a signature that won't throw along to the commit.
256+
_repo.Commit(message, GetSignature());
244257
}
245258
catch (LibGit2SharpException ex)
246259
{

0 commit comments

Comments
 (0)