Skip to content

Commit

Permalink
chore: clear local bare clone immediately after diff generation #550
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSlome committed May 10, 2024
1 parent 0be8da8 commit 538b163
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/proxy/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const pushActionChain = [
proc.push.pullRemote,
proc.push.writePack,
proc.push.getDiff,
proc.push.clearBareClone,
proc.push.scanDiff,
proc.push.blockForAuth,
];
Expand Down
20 changes: 20 additions & 0 deletions src/proxy/processors/push-action/clearBareClone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const Step = require('../../actions').Step;
const fs = require('node:fs');

const exec = async (req, action) => {
const step = new Step('clearBareClone');

Check warning on line 5 in src/proxy/processors/push-action/clearBareClone.js

View check run for this annotation

Codecov / codecov/patch

src/proxy/processors/push-action/clearBareClone.js#L5

Added line #L5 was not covered by tests

// Recursively remove the contents of ./.remote and ignore exceptions
fs.rm('./.remote', { recursive: true, force: true }, (err) => {
if (err) {
throw err;

Check warning on line 10 in src/proxy/processors/push-action/clearBareClone.js

View check run for this annotation

Codecov / codecov/patch

src/proxy/processors/push-action/clearBareClone.js#L8-L10

Added lines #L8 - L10 were not covered by tests
}
console.log(`.remote is deleted!`);

Check warning on line 12 in src/proxy/processors/push-action/clearBareClone.js

View check run for this annotation

Codecov / codecov/patch

src/proxy/processors/push-action/clearBareClone.js#L12

Added line #L12 was not covered by tests
});

action.addStep(step);
return action;

Check warning on line 16 in src/proxy/processors/push-action/clearBareClone.js

View check run for this annotation

Codecov / codecov/patch

src/proxy/processors/push-action/clearBareClone.js#L15-L16

Added lines #L15 - L16 were not covered by tests
};

exec.displayName = 'clearBareClone.exec';
exports.exec = exec;
1 change: 1 addition & 0 deletions src/proxy/processors/push-action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ exports.checkIfWaitingAuth = require('./checkIfWaitingAuth').exec;
exports.checkCommitMessages = require('./checkCommitMessages').exec;
exports.checkAuthorEmails = require('./checkAuthorEmails').exec;
exports.checkUserPushPermission = require('./checkUserPushPermission').exec;
exports.clearBareClone = require('./clearBareClone').exec;

0 comments on commit 538b163

Please sign in to comment.