nodegit: Fix return type of Commit#amend

This commit is contained in:
Tobias Nießen
2018-06-05 20:44:13 +02:00
parent 97c122f22f
commit 6cfd95fb7f
3 changed files with 9 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ export class Commit {
static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Commit>;
static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise<Oid>;
amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Oid;
amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise<Oid>;
author(): Signature;
committer(): Signature;

View File

@@ -1,6 +1,6 @@
// Type definitions for nodegit 0.18
// Type definitions for nodegit 0.22
// Project: https://github.com/nodegit/nodegit
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Definitions by: Dolan Miu <https://github.com/dolanmiu>, Tobias Nießen <https://github.com/tniessen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export { AnnotatedCommit } from './annotated-commit';

View File

@@ -11,6 +11,7 @@ Git.Repository.init("path", 0).then((repository) => {
const repo = new Git.Repository();
const id = new Git.Oid();
const ref = new Git.Reference();
const tree = new Git.Tree();
// AnnotatedCommit Tests
@@ -52,6 +53,11 @@ Git.Branch.lookup(repo, "branch_name", Git.Branch.BRANCH.LOCAL).then((reference)
// Use reference
});
repo.getCommit("0123456789abcdef0123456789abcdef").then((commit) => {
const sig = Git.Signature.now('John Doe', 'jd@example.com');
const newCommit: Promise<Git.Oid> = commit.amend('ref', sig, sig, 'utf8', 'message', tree);
});
const signature = Git.Signature.now("name", "email");
signature.name();
signature.email();