From cd55298875243de30b66dbacfe812610ef73b590 Mon Sep 17 00:00:00 2001 From: Tyler Ang-Wanek Date: Fri, 13 Sep 2019 12:00:35 -0700 Subject: [PATCH] updateTips: optional param and normalizeOptions --- generate/input/descriptor.json | 5 +++++ lib/remote.js | 36 +++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 4bc158793..b50384f57 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -3300,6 +3300,11 @@ }, "git_remote_update_tips": { "isAsync": true, + "args": { + "reflog_message": { + "isOptional": true + } + }, "return": { "isErrorCode": true } diff --git a/lib/remote.js b/lib/remote.js index 510ce9b8b..258aaf467 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -11,6 +11,7 @@ var _createWithOpts = Remote.createWithOpts; var _download = Remote.prototype.download; var _fetch = Remote.prototype.fetch; var _push = Remote.prototype.push; +var _updateTips = Remote.prototype.updateTips; var _upload = Remote.prototype.upload; /** @@ -146,6 +147,40 @@ Remote.prototype.fetch = function(refspecs, opts, reflog_message) { .call(this, refspecs, normalizeFetchOptions(opts), reflog_message); }; +/** + * Update the tips to the new state + * @param {RemoteCallbacks} callbacks The callback functions for the connection + * @param {boolean} updateFetchhead whether to write to FETCH_HEAD. Pass true + * to behave like git. + * @param {boolean} downloadTags what the behaviour for downloading tags is + * for this fetch. This is ignored for push. + * This must be the same value passed to + * Remote.prototype.download + * @param {string} reflogMessage The message to insert into the reflogs. If + * null and fetching, the default is "fetch ", + * where is the name of the remote (or its url, + * for in-memory remotes). This parameter is + * ignored when pushing. + */ +Remote.prototype.updateTips = function( + callbacks, + updateFetchhead, + downloadTags, + reflogMessage +) { + if (callbacks) { + callbacks = normalizeOptions(callbacks, NodeGit.RemoteCallbacks); + } + + return _updateTips.call( + this, + callbacks, + updateFetchhead, + downloadTags, + reflogMessage + ); +}; + /** * Pushes to a remote * @@ -184,7 +219,6 @@ Remote.prototype.upload = function(refSpecs, opts) { return _upload.call(this, refSpecs, opts); }; - NodeGit.Remote.COMPLETION_TYPE = {}; var DEPRECATED_STATES = { COMPLETION_DOWNLOAD: "DOWNLOAD",