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

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"})
});
});
}
}
});