Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianjost committed Aug 2, 2023
1 parent 8f368df commit bb3d4c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@ module.exports = {
};

const hasChanges = async () => {
await updateIndex();
const statusOutput = await execCmd(
`git status --porcelain`,
getRepoPath()
);
return porcelainParse(statusOutput).length !== 0;
};

const updateIndex = async () => {
await execCmd(`git update-index --really-refresh -q`, getRepoPath());
};

const commitAll = async () => {
if (!(await hasChanges())) {
log.info("NO CHANGES DETECTED");
Expand Down Expand Up @@ -102,10 +97,10 @@ module.exports = {
} catch (error) {
log.error(error);
} finally {
if (!output.includes("Update file(s) from")) {
log.error(output);
throw new Error("failed to commit changes");
}
// if (!output.includes("Update file(s) from")) {
// log.error(output);
// throw new Error("failed to commit changes");
// }
}
}
log.info("CHANGES COMMITED");
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const main = async () => {
await gitRepo.commitAll();
}
} catch (err) {
log.error("ERROR:", err);
error = err;
}

Expand Down

0 comments on commit bb3d4c4

Please sign in to comment.