Skip to content

Commit

Permalink
use mem-fs-editor clearState to clear skipped files state
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 3, 2022
1 parent 9ae02b3 commit 1705e04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const findUp = require('find-up');
const minimatch = require('minimatch');
const {transform, passthrough, filter} = require('p-transform');
const OOOTransform = require('./out-of-order-transform');
const {clearFileState} = require('mem-fs-editor/lib/state.js');

const {Minimatch} = minimatch;

Expand Down Expand Up @@ -198,8 +199,7 @@ function createConflicterStatusTransform() {
}

if (action === 'skip') {
delete file.state;
delete file.isNew;
clearFileState(file);
return undefined;
}
return file;
Expand Down
6 changes: 6 additions & 0 deletions test/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ describe('Transform stream', () => {
assert.equal(file.conflicterLog, undefined);
}
});

it('should clear the state of skipped file', () => {
assert.equal(conflicterSkippedFile.state, undefined);
assert.equal(conflicterSkippedFile.isNew, undefined);
assert.equal(conflicterSkippedFile.stateCleared, 'modified');
});
});

describe('getConflicterStatusForFile()', () => {
Expand Down

0 comments on commit 1705e04

Please sign in to comment.