MCPcopy
hub / github.com/Kong/insomnia / push

Method push

packages/insomnia/src/sync/git/git-vcs.ts:1167–1199  ·  view source on GitHub ↗
(credentialsId?: string | null, force = false)

Source from the content-addressed store, hash-verified

1165 }
1166
1167 async push(credentialsId?: string | null, force = false) {
1168 console.log(`[git] Push remote=origin force=${force ? 'true' : 'false'}`);
1169
1170 const response = await git.push({
1171 ...this._baseOpts,
1172 ...gitCallbacks(credentialsId),
1173 remote: 'origin',
1174 force,
1175 });
1176
1177 if (response.error) {
1178 console.log('[git] Push rejected', response);
1179 throw new Error(
1180 `Push rejected with errors: ${response.error}.\n\nGo to View > Toggle DevTools > Console for more information.`,
1181 );
1182 }
1183
1184 if ('errors' in response && response.errors && Array.isArray(response.errors)) {
1185 console.log('[git] Push failed with errors', response.errors);
1186 const errorsString = JSON.stringify(response.errors);
1187 throw new Error(
1188 `Push rejected with errors: ${errorsString}.\n\nGo to View > Toggle DevTools > Console for more information.`,
1189 );
1190 }
1191
1192 // NOTE: Response can be ok and have errors so we check this in the end to make sure we throw an error if there are any.
1193 if (response.ok) {
1194 console.log('[git] Push successful');
1195 return;
1196 }
1197
1198 throw new Error('Push failed with unknown error. Please try again.');
1199 }
1200
1201 async hasUncommittedChanges() {
1202 const changes = await this.status();

Callers 15

getChildToParentMapFunction · 0.45
collectAncestorsFunction · 0.45
addModifierKeysFunction · 0.45
_fixMultipleCookieJarsFunction · 0.45
collectDescendantsFunction · 0.45
createNedbDatabaseFunction · 0.45
nextFunction · 0.45
findDescendantsFunction · 0.45
notifyOfChangeFunction · 0.45
callbackFunction · 0.45

Calls 3

gitCallbacksFunction · 0.90
stringifyMethod · 0.80
logMethod · 0.45

Tested by 8

callbackFunction · 0.36
ComponentFunction · 0.36
clientActionFunction · 0.36
clientActionFunction · 0.36
operation1Function · 0.36
operation2Function · 0.36
operation3Function · 0.36
loggerFunction · 0.36