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

Commit c4dac97

Browse files
committed
document method, and add null check
1 parent 128eadf commit c4dac97

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/GitHub.Exports/Services/GitService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Threading.Tasks;
66
using GitHub.Models;
77
using System.Linq;
8+
using GitHub.Extensions;
89

910
namespace GitHub.Services
1011
{
@@ -72,8 +73,15 @@ public UriString GetRemoteUri(IRepository repo, string remote = "origin")
7273

7374
public static IGitService GitServiceHelper => VisualStudio.Services.DefaultExportProvider.GetExportedValueOrDefault<IGitService>() ?? new GitService();
7475

76+
/// <summary>
77+
/// Finds the latest pushed commit of a file and returns the sha of that commit. Returns null when no commits have
78+
/// been found in any remote branches or the current local branch.
79+
/// </summary>
80+
/// <param name="path">The local path of the file. This cannot be null.</param>
81+
/// <returns></returns>
7582
public Task<string> GetLatestPushedSha(string path)
7683
{
84+
Guard.ArgumentNotNull(path, nameof(path));
7785
var repo = GetRepository(path);
7886

7987
if (repo.Head.IsTracking && repo.Head.Tip.Sha == repo.Head.TrackedBranch.Tip.Sha)

0 commit comments

Comments
 (0)