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

Commit c61d0f2

Browse files
committed
Make GitService.Refresh the CurrentBranch
Previously CurrentBranch was created as the property was read. We now need a way to refresh it.
1 parent 2f13d62 commit c61d0f2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/GitHub.Exports/Models/ILocalRepositoryModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public interface ILocalRepositoryModel : IRepositoryModel, INotifyPropertyChange
1515
/// <summary>
1616
/// Gets the current branch.
1717
/// </summary>
18-
IBranch CurrentBranch { get; }
18+
IBranch CurrentBranch { get; set; }
1919
}
2020
}

src/GitHub.Exports/Services/GitService.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public ILocalRepositoryModel CreateLocalRepositoryModel(string localPath)
5555
}
5656

5757
/// <summary>
58-
/// Updates the CloneUrl from the local repository.
58+
/// Updates the CloneUrl and CurrentBranch from the local repository.
5959
/// </summary>
6060
public void Refresh(ILocalRepositoryModel localRepositoryModel)
6161
{
@@ -64,6 +64,8 @@ public void Refresh(ILocalRepositoryModel localRepositoryModel)
6464
return;
6565

6666
localRepositoryModel.CloneUrl = GetUri(localPath);
67+
68+
RefreshCurrentBranch(localRepositoryModel);
6769
}
6870

6971
/// <summary>
@@ -199,7 +201,7 @@ public Task<string> GetLatestPushedSha(string path, string remote = "origin")
199201
});
200202
}
201203

202-
void RefreshCurrentBranch(LocalRepositoryModel model)
204+
void RefreshCurrentBranch(ILocalRepositoryModel model)
203205
{
204206
var localPath = model.LocalPath;
205207
using (var repo = GetRepository(localPath))

0 commit comments

Comments
 (0)