Skip to content

Commit

Permalink
fix: status running before copy (#237) - fixes #103
Browse files Browse the repository at this point in the history
should fix #103
  • Loading branch information
immjs authored Jul 31, 2023
1 parent dbf302c commit 2768642
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ module.exports = {
return porcelainParse(statusOutput).length !== 0;
};

const refreshIndex = async () => {
await execCmd("git update-index --really-refresh");
};

const commitAll = async () => {
if (!(await hasChanges())) {
logger.info("NO CHANGES DETECTED");
Expand Down Expand Up @@ -108,6 +112,7 @@ module.exports = {
return {
clone,
commitAll,
refreshIndex,
};
},
};
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const main = async () => {
// UPDATE FILES
await Promise.all([
utilsRepo.removeFiles(removedFiles),
srcFiles.map(async (srcFile) =>
...srcFiles.map(async (srcFile) =>
utilsRepo.copyFile(
srcFile,
path.join(
Expand All @@ -52,6 +52,9 @@ const main = async () => {
),
]);

// REFRESH INDEX
await gitRepo.refreshIndex();

// COMMIT UPDATES
await gitRepo.commitAll();

Expand Down

0 comments on commit 2768642

Please sign in to comment.