1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #2957 from node-red-hitachi/fix-error-on-git-auto-commit

fix error on auto commit for no flow change
This commit is contained in:
Nick O'Leary 2021-04-26 11:54:05 +01:00 committed by GitHub
commit f5a1c8bc49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -608,8 +608,15 @@ async function saveFlows(flows, user) {
var workflowMode = (gitSettings.workflow||{}).mode || settings.editorTheme.projects.workflow.mode;
if (workflowMode === 'auto') {
return activeProject.stageFile([flowsFullPath, credentialsFile]).then(() => {
return activeProject.commit(user,{message:"Update flow files"})
})
return activeProject.status(user, false).then((result) => {
const items = Object.values(result.files || {});
// check if saved flow make modification to repository
if (items.findIndex((item) => (item.status === "M ")) < 0) {
return Promise.resolve();
}
return activeProject.commit(user,{message:"Update flow files"})
});
});
}
}
});