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

Update to use LibGit2Sharp v0.24 #1248

Merged
merged 10 commits into from
Oct 11, 2017
Prev Previous commit
Next Next commit
Add TODO comments for deprecated API calls
  • Loading branch information
jcansdale committed Oct 10, 2017
commit c54fc89f2199bf635f876b2c25d1a30110c5874b
10 changes: 5 additions & 5 deletions src/GitHub.App/Services/GitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Task Pull(IRepository repository)
return Task.Factory.StartNew(() =>
{
var signature = repository.Config.BuildSignature(DateTimeOffset.UtcNow);
#pragma warning disable 0618 // Network.Pull is deprecated
#pragma warning disable 0618 // TODO: Replace `Network.Pull` with `Commands.Pull`.
repository.Network.Pull(signature, pullOptions);
#pragma warning restore 0618
});
Expand Down Expand Up @@ -76,7 +76,7 @@ public Task Fetch(IRepository repository, string remoteName)
try
{
var remote = repository.Network.Remotes[remoteName];
#pragma warning disable 0618 // Network.Fetch is deprecated
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
repository.Network.Fetch(remote, fetchOptions);
#pragma warning restore 0618
}
Expand Down Expand Up @@ -108,7 +108,7 @@ public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs
var remote = repo.Network.Remotes.Add(tempRemoteName, httpsUrl);
try
{
#pragma warning disable 0618 // Network.Fetch is deprecated
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
repo.Network.Fetch(remote, refspecs, fetchOptions);
#pragma warning restore 0618
}
Expand Down Expand Up @@ -137,7 +137,7 @@ public Task Fetch(IRepository repository, string remoteName, params string[] ref
try
{
var remote = repository.Network.Remotes[remoteName];
#pragma warning disable 0618 // Network.Fetch is deprecated
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
repository.Network.Fetch(remote, refspecs, fetchOptions);
#pragma warning restore 0618
}
Expand All @@ -158,7 +158,7 @@ public Task Checkout(IRepository repository, string branchName)

return Task.Factory.StartNew(() =>
{
#pragma warning disable 0618 // IRepository.Checkout is deprecated
#pragma warning disable 0618 // TODO: Replace `IRepository.Checkout` with `Commands.Checkout`.
repository.Checkout(branchName);
#pragma warning restore 0618
});
Expand Down
3 changes: 1 addition & 2 deletions src/GitHub.Exports/Models/BranchModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public BranchModel(LibGit2Sharp.Branch branch, IRepositoryModel repo)
{
Extensions.Guard.ArgumentNotNull(branch, nameof(branch));
Extensions.Guard.ArgumentNotNull(repo, nameof(repo));

Name = DisplayName = branch.FriendlyName;
#pragma warning disable 0618 // Branch.Remote is deprecated
#pragma warning disable 0618 // TODO: Replace `Branch.Remote` with `Repository.Network.Remotes[branch.RemoteName]`.
var remoteUrl = branch.Remote.Url;
Copy link
Collaborator Author

@jcansdale jcansdale Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bug was introduced here. Remote will be null if IsRemote is false.

#pragma warning restore 0618
Repository = branch.IsRemote ? new LocalRepositoryModel(remoteUrl) : repo;
Expand Down