Skip to content

Commit 79126a0

Browse files
fix(API): incorrect way of passing args to execa (#56)
Fixes business logic of force unstaging
1 parent ede3b0d commit 79126a0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ const del = require('del');
44
const execa = require('execa');
55
const hasLockfile = require('has-lockfile');
66

7-
const forceGitRemove = (lockfiles, cwd) => {
8-
return execa('git', ['rm', '-f', lockfiles.join(' ')], {
7+
const remove = (files, cwd) => {
8+
return execa('git', ['rm', '-f'].concat(files), {
99
cwd,
1010
reject: false,
11-
});
11+
})
12+
.then(() => del(files, { cwd }))
13+
.then(() => files);
1214
};
1315

1416
const removeLockfiles = (cwd = process.cwd()) => {
1517
const lockfiles = hasLockfile(cwd);
1618

17-
return lockfiles.length > 0
18-
? forceGitRemove(lockfiles, cwd)
19-
.then(() => del(lockfiles, { cwd }))
20-
.then(() => lockfiles)
21-
: Promise.resolve(lockfiles);
19+
return lockfiles.length === 0
20+
? Promise.resolve(lockfiles)
21+
: remove(lockfiles, cwd);
2222
};
2323

2424
module.exports = removeLockfiles;

0 commit comments

Comments
 (0)