exec-staged 0.2.0 → 0.2.2
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/README.md +4 -0
- package/dist/lib/stage.js +6 -4
- package/package.json +1 -1
- package/src/lib/stage.ts +6 -4
package/README.md
CHANGED
package/dist/lib/stage.js
CHANGED
|
@@ -66,7 +66,7 @@ export class Stage {
|
|
|
66
66
|
this.logger.log('⚠️ Git installation not found!');
|
|
67
67
|
throw new Error('git installation not found');
|
|
68
68
|
}
|
|
69
|
-
if (!version || semver.
|
|
69
|
+
if (!version || semver.lt(version, '2.22.0')) {
|
|
70
70
|
this.logger.log('⚠️ Unsupported git version!');
|
|
71
71
|
throw new Error('unsupported git version');
|
|
72
72
|
}
|
|
@@ -135,7 +135,8 @@ export class Stage {
|
|
|
135
135
|
this.git([
|
|
136
136
|
'diff',
|
|
137
137
|
'--binary',
|
|
138
|
-
'--
|
|
138
|
+
'--src-prefix=a/',
|
|
139
|
+
'--dst-prefix=b/',
|
|
139
140
|
// skip deleted files because patch doesn't apply if they're modified
|
|
140
141
|
'--diff-filter=d',
|
|
141
142
|
'--no-color',
|
|
@@ -248,11 +249,12 @@ export class Stage {
|
|
|
248
249
|
]);
|
|
249
250
|
// unstaged deletions are not included in the patch and must be handled
|
|
250
251
|
// separately because the patch cannot be applied if such files are
|
|
251
|
-
// modified by tasks
|
|
252
|
+
// modified by tasks; use force: true to handle cases where the file
|
|
253
|
+
// doesn't exist (e.g., unstaged renames)
|
|
252
254
|
Object.entries(this.status)
|
|
253
255
|
.filter(([, s]) => s.match(/^.D/))
|
|
254
256
|
.map(([f]) => f)
|
|
255
|
-
.forEach((f) => fs.rmSync(path.resolve(this.cwd, f)));
|
|
257
|
+
.forEach((f) => fs.rmSync(path.resolve(this.cwd, f), { force: true }));
|
|
256
258
|
// make sure all restored unstaged changes are kept out of the index
|
|
257
259
|
this.git(['reset']);
|
|
258
260
|
// undo temporary commit while keeping its changes in the index
|
package/package.json
CHANGED
package/src/lib/stage.ts
CHANGED
|
@@ -85,7 +85,7 @@ export class Stage {
|
|
|
85
85
|
throw new Error('git installation not found');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
if (!version || semver.
|
|
88
|
+
if (!version || semver.lt(version, '2.22.0')) {
|
|
89
89
|
this.logger.log('⚠️ Unsupported git version!');
|
|
90
90
|
throw new Error('unsupported git version');
|
|
91
91
|
}
|
|
@@ -185,7 +185,8 @@ export class Stage {
|
|
|
185
185
|
this.git([
|
|
186
186
|
'diff',
|
|
187
187
|
'--binary',
|
|
188
|
-
'--
|
|
188
|
+
'--src-prefix=a/',
|
|
189
|
+
'--dst-prefix=b/',
|
|
189
190
|
// skip deleted files because patch doesn't apply if they're modified
|
|
190
191
|
'--diff-filter=d',
|
|
191
192
|
'--no-color',
|
|
@@ -323,11 +324,12 @@ export class Stage {
|
|
|
323
324
|
|
|
324
325
|
// unstaged deletions are not included in the patch and must be handled
|
|
325
326
|
// separately because the patch cannot be applied if such files are
|
|
326
|
-
// modified by tasks
|
|
327
|
+
// modified by tasks; use force: true to handle cases where the file
|
|
328
|
+
// doesn't exist (e.g., unstaged renames)
|
|
327
329
|
Object.entries(this.status)
|
|
328
330
|
.filter(([, s]) => s.match(/^.D/))
|
|
329
331
|
.map(([f]) => f)
|
|
330
|
-
.forEach((f) => fs.rmSync(path.resolve(this.cwd, f)));
|
|
332
|
+
.forEach((f) => fs.rmSync(path.resolve(this.cwd, f), { force: true }));
|
|
331
333
|
|
|
332
334
|
// make sure all restored unstaged changes are kept out of the index
|
|
333
335
|
this.git(['reset']);
|