Skip to content

Commit

Permalink
Merge pull request #1722 from implausible/fix/optional-parameter-on-u…
Browse files Browse the repository at this point in the history
…pdate-tips

updateTips: optional param and normalizeOptions
  • Loading branch information
implausible authored Sep 13, 2019
2 parents 0228707 + cd55298 commit 372635a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3300,6 +3300,11 @@
},
"git_remote_update_tips": {
"isAsync": true,
"args": {
"reflog_message": {
"isOptional": true
}
},
"return": {
"isErrorCode": true
}
Expand Down
36 changes: 35 additions & 1 deletion lib/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 372635a

Please sign in to comment.