diff --git a/types/nodegit/annotated-commit.d.ts b/types/nodegit/annotated-commit.d.ts index f0f9d4d925..0fb5465647 100644 --- a/types/nodegit/annotated-commit.d.ts +++ b/types/nodegit/annotated-commit.d.ts @@ -3,11 +3,36 @@ import { Oid } from './oid'; import { Reference } from './reference'; export class AnnotatedCommit { - static fromFetchhead(repo: Repository, branch_name: string, remote_url: string, id: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo - repository that contains the given commit + * @param {string} branchName - name of the (remote) branch + * @param {string} remoteUrl - url of the remote + * @param {Oid} id - the commit object id of the remote branch + * @returns {Promise} + * + * @memberof AnnotatedCommit + */ + static fromFetchhead(repo: Repository, branchName: string, remoteUrl: string, id: Oid): Promise; static fromRef(repo: Repository, ref: Reference): Promise; static fromRevspec(repo: Repository, revspec: string): Promise; static lookup(repo: Repository, id: Oid): Promise; + /** + * + * + * + * @memberof AnnotatedCommit + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof AnnotatedCommit + */ id(): Oid; } diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts index 84a701f2b1..4966c407e0 100644 --- a/types/nodegit/attr.d.ts +++ b/types/nodegit/attr.d.ts @@ -13,6 +13,6 @@ export class Attr { static addMacro(repo: Repository, name: string, values: string): number; static cacheFlush(repo: Repository): void; static get(repo: Repository, flags: number, path: string, name: string): Promise; - static getMany(repo: Repository, flags: number, path: string, num_attr: number, names: string): any[]; + static getMany(repo: Repository, flags: number, path: string, numAttr: number, names: string): any[]; static value(attr: string): number; } diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index c4c57854b7..370369eed4 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -1,9 +1,47 @@ import * as Git from 'nodegit'; Git.Repository.discover("startPath", 1, "ceilingDirs").then((string) => { - // Use string + // Use string }); Git.Repository.init("path", true).then((repository) => { - // Use repository + // Use repository }); + +const repo = new Git.Repository(); +const id = new Git.Oid(); +const ref = new Git.Reference(); + +// AnnotatedCommit Tests + +Git.AnnotatedCommit.fromFetchhead(repo, "branch_name", "remote_url", id).then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.fromRef(repo, ref).then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.fromRevspec(repo, "revspec").then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.lookup(repo, id).then((annotatedCommit) => { + // Use annotatedCommit + annotatedCommit.free(); + annotatedCommit.id(); +}); + +// Attr tests + +let result = Git.Attr.addMacro(repo, "name", "values"); + +Git.Attr.cacheFlush(repo); + +Git.Attr.get(repo, 1, "path", "name").then((string) => { + // Use string +}); + +let array = Git.Attr.getMany(repo, 1, "path", 1, "names"); + +result = Git.Attr.value("attr");