Skip to content

Commit d878b99

Browse files
authored
Merge pull request #45 from dabutvin/empty-repos
exit if no refs in the repo
2 parents 5eb94f0 + 023bcb7 commit d878b99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ImgBot.Function/CompressImages.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ public static async Task RunAsync(CompressimagesParameters parameters)
3636
var repo = new LibGit2Sharp.Repository(parameters.LocalPath);
3737
var remote = repo.Network.Remotes["origin"];
3838

39-
// check if we have the branch already
39+
// check if we have the branch already or this is empty repo
4040
try
4141
{
42+
if (repo.Network.ListReferences(remote, credentialsProvider).Any() == false)
43+
return;
44+
4245
if (repo.Network.ListReferences(remote, credentialsProvider).Any(x => x.CanonicalName == $"refs/heads/{BranchName}"))
4346
return;
4447
}

0 commit comments

Comments
 (0)