Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit c6da91d

Browse files
committed
Make BranchModel dependency IGitService explicit
Be explicit when BranchModel constructor depends on IGitService.
1 parent ba31f82 commit c6da91d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/GitHub.Exports/Models/BranchModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public BranchModel(Octokit.Branch branch, IRepositoryModel repo)
2626
Id = String.Format(CultureInfo.InvariantCulture, "{0}/{1}", Repository.Owner, Name);
2727
}
2828

29-
public BranchModel(LibGit2Sharp.Branch branch, IRepositoryModel repo)
29+
public BranchModel(LibGit2Sharp.Branch branch, IRepositoryModel repo, IGitService gitService)
3030
{
3131
Extensions.Guard.ArgumentNotNull(branch, nameof(branch));
3232
Extensions.Guard.ArgumentNotNull(repo, nameof(repo));
3333
Name = DisplayName = branch.FriendlyName;
3434
#pragma warning disable 0618 // TODO: Replace `Branch.Remote` with `Repository.Network.Remotes[branch.RemoteName]`.
35-
Repository = branch.IsRemote ? new LocalRepositoryModel(branch.Remote.Url, GitService.GitServiceHelper) : repo;
35+
Repository = branch.IsRemote ? new LocalRepositoryModel(branch.Remote.Url, gitService) : repo;
3636
#pragma warning restore 0618
3737
IsTracking = branch.IsTracking;
3838
Sha = branch.Tip?.Sha;

src/GitHub.Exports/Models/LocalRepositoryModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public IBranch CurrentBranch
183183
// BranchModel doesn't keep a reference to Repository
184184
using (var repo = gitService.GetRepository(LocalPath))
185185
{
186-
return new BranchModel(repo?.Head, this);
186+
return new BranchModel(repo?.Head, this, gitService);
187187
}
188188
}
189189
}

0 commit comments

Comments
 (0)