From 6cfd95fb7fe0a931c8161656bf4e9a2ea95a9e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 5 Jun 2018 20:44:13 +0200 Subject: [PATCH] nodegit: Fix return type of Commit#amend --- types/nodegit/commit.d.ts | 2 +- types/nodegit/index.d.ts | 4 ++-- types/nodegit/nodegit-tests.ts | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 5c9a82bf70..11ab938130 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -21,7 +21,7 @@ export class Commit { static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; - 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; author(): Signature; committer(): Signature; diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index e6d95ba83e..d1afcd6ea4 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -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 +// Definitions by: Dolan Miu , Tobias Nießen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index 00d988d77f..1732844d1c 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -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 = commit.amend('ref', sig, sig, 'utf8', 'message', tree); +}); + const signature = Git.Signature.now("name", "email"); signature.name(); signature.email();