/// <summary> /// Gets a commit for a given repository by sha reference /// </summary> /// <remarks> /// http://developer.github.com/v3/git/commits/#get-a-commit /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">Tha sha reference of the commit</param> public IObservable <Commit> Get(string owner, string name, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); return(_client.Get(owner, name, reference).ToObservable()); }
public async Task CanCreateAndRetrieveCommit() { var blob = new NewBlob { Content = "Hello World!", Encoding = EncodingType.Utf8 }; var blobResult = await _client.GitDatabase.Blob.Create(_owner, _repository.Name, blob); var newTree = new NewTree(); newTree.Tree.Add(new NewTreeItem { Type = TreeType.Blob, Mode = FileMode.File, Path = "README.md", Sha = blobResult.Sha }); var treeResult = await _client.GitDatabase.Tree.Create(_owner, _repository.Name, newTree); var newCommit = new NewCommit("test-commit", treeResult.Sha); var commit = await _fixture.Create(_owner, _repository.Name, newCommit); Assert.NotNull(commit); var retrieved = await _fixture.Get(_owner, _repository.Name, commit.Sha); Assert.NotNull(retrieved); }