Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status running before copy #237

Merged
merged 4 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -107,6 +111,7 @@ module.exports = {

return {
clone,
refreshIndex,
commitAll,
};
},
Expand Down
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