|
|
|
@ -11,7 +11,7 @@ interface GitPlugin {
|
|
|
|
Task: {
|
|
|
|
Task: {
|
|
|
|
prototype: {
|
|
|
|
prototype: {
|
|
|
|
save: {
|
|
|
|
save: {
|
|
|
|
leave: (plugin: GitPlugin, task: any) => void;
|
|
|
|
leave: (plugin: GitPlugin, task: any) => Promise<any>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -73,12 +73,12 @@ async function cloneRepository(
|
|
|
|
this: any,
|
|
|
|
this: any,
|
|
|
|
plugin: GitPlugin,
|
|
|
|
plugin: GitPlugin,
|
|
|
|
createdTask: any,
|
|
|
|
createdTask: any,
|
|
|
|
): Promise<void> {
|
|
|
|
): Promise<any> {
|
|
|
|
return new Promise((resolve, reject): void => {
|
|
|
|
return new Promise((resolve, reject): any => {
|
|
|
|
if (typeof (this.id) !== 'undefined' || plugin.data.task !== this) {
|
|
|
|
if (typeof (this.id) !== 'undefined' || plugin.data.task !== this) {
|
|
|
|
// not the first save, we do not need to clone the repository
|
|
|
|
// not the first save, we do not need to clone the repository
|
|
|
|
// or anchor set for another task
|
|
|
|
// or anchor set for another task
|
|
|
|
resolve();
|
|
|
|
resolve(createdTask);
|
|
|
|
} else if (plugin.data.repos) {
|
|
|
|
} else if (plugin.data.repos) {
|
|
|
|
if (plugin.callbacks.onStatusChange) {
|
|
|
|
if (plugin.callbacks.onStatusChange) {
|
|
|
|
plugin.callbacks.onStatusChange('The repository is being cloned..');
|
|
|
|
plugin.callbacks.onStatusChange('The repository is being cloned..');
|
|
|
|
@ -95,7 +95,7 @@ async function cloneRepository(
|
|
|
|
tid: createdTask.id,
|
|
|
|
tid: createdTask.id,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
}).then(waitForClone).then((): void => {
|
|
|
|
}).then(waitForClone).then((): void => {
|
|
|
|
resolve();
|
|
|
|
resolve(createdTask);
|
|
|
|
}).catch((error: any): void => {
|
|
|
|
}).catch((error: any): void => {
|
|
|
|
createdTask.delete().finally((): void => {
|
|
|
|
createdTask.delete().finally((): void => {
|
|
|
|
reject(
|
|
|
|
reject(
|
|
|
|
|