Skip to content

Commit cf3d1c9

Browse files
committed
Throw a SourceControlException if there's a bad config.
Related to #722. When initializing a VBA repository, it's possible that the user hasn't set up a gitconfig yet. Rethrow our own standard exception for the situation to be handled in the UI layer.
1 parent a2db3ed commit cf3d1c9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Rubberduck.SourceControl/GitProvider.cs

Lines changed: 11 additions & 1 deletion
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+
//If the user hasn't set up their name, this could throw an exception.
156+
//There may be other situations in which this could occur, but I'm not sure what they are right now.
157+
//Todo: consider a more specific exception that inherits from SourceControlException.
158+
try
159+
{
160+
repo.Commit("Intial Commit");
161+
}
162+
catch(LibGit2SharpException ex)
163+
{
164+
throw new SourceControlException("Unable to perform intial commit.", ex);
165+
}
156166
}
157167

158168
return repository;

0 commit comments

Comments
 (0)