exec-staged 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/stage.js CHANGED
@@ -248,11 +248,12 @@ export class Stage {
248
248
  ]);
249
249
  // unstaged deletions are not included in the patch and must be handled
250
250
  // separately because the patch cannot be applied if such files are
251
- // modified by tasks
251
+ // modified by tasks; use force: true to handle cases where the file
252
+ // doesn't exist (e.g., unstaged renames)
252
253
  Object.entries(this.status)
253
254
  .filter(([, s]) => s.match(/^.D/))
254
255
  .map(([f]) => f)
255
- .forEach((f) => fs.rmSync(path.resolve(this.cwd, f)));
256
+ .forEach((f) => fs.rmSync(path.resolve(this.cwd, f), { force: true }));
256
257
  // make sure all restored unstaged changes are kept out of the index
257
258
  this.git(['reset']);
258
259
  // undo temporary commit while keeping its changes in the index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exec-staged",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Run commands against the current git index",
5
5
  "keywords": [
6
6
  "git",
package/src/lib/stage.ts CHANGED
@@ -323,11 +323,12 @@ export class Stage {
323
323
 
324
324
  // unstaged deletions are not included in the patch and must be handled
325
325
  // separately because the patch cannot be applied if such files are
326
- // modified by tasks
326
+ // modified by tasks; use force: true to handle cases where the file
327
+ // doesn't exist (e.g., unstaged renames)
327
328
  Object.entries(this.status)
328
329
  .filter(([, s]) => s.match(/^.D/))
329
330
  .map(([f]) => f)
330
- .forEach((f) => fs.rmSync(path.resolve(this.cwd, f)));
331
+ .forEach((f) => fs.rmSync(path.resolve(this.cwd, f), { force: true }));
331
332
 
332
333
  // make sure all restored unstaged changes are kept out of the index
333
334
  this.git(['reset']);