public GitRef(GitFullRefName fullName, GitSha1 target) { Guard.NotNull(fullName, nameof(fullName)); Guard.NotNull(target, nameof(target)); FullName = fullName; Name = new GitRefNameComponent(fullName.ToString().Split('/').Last()); Target = target; IsBranch = FullName.ToString().StartsWith("refs/heads/", StringComparison.Ordinal); IsTag = FullName.ToString().StartsWith("refs/tags/", StringComparison.Ordinal); }
/// <summary> /// Try resolving a rev to a commit sha1 /// </summary> /// public bool TryGetCommitId(GitRev rev, out GitSha1 sha1) { Guard.NotNull(rev, nameof(rev)); try { sha1 = GetCommitId(rev); return(true); } catch (GitException) { sha1 = default; return(false); } }
public GitCommitInfo( GitSha1 sha1, IEnumerable <GitSha1> parentSha1s, string author, DateTimeOffset authorDate, string committer, DateTimeOffset commitDate, IReadOnlyList <string> messageLines) { Guard.NotNull(sha1, nameof(sha1)); Guard.NotNull(parentSha1s, nameof(parentSha1s)); Guard.NotNull(author, nameof(author)); Guard.NotNull(committer, nameof(committer)); Guard.NotNull(messageLines, nameof(messageLines)); Sha1 = sha1; ParentSha1s = parentSha1s.ToList(); Author = author; AuthorDate = authorDate; Committer = committer; CommitDate = commitDate; MessageLines = messageLines; }