czon 0.8.2 → 0.8.3
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/utils/git.js +13 -12
- package/package.json +1 -1
package/dist/utils/git.js
CHANGED
|
@@ -15,21 +15,22 @@ exports.isUntracked = isUntracked;
|
|
|
15
15
|
const child_process_1 = require("child_process");
|
|
16
16
|
/**
|
|
17
17
|
* Execute a git command and return the output
|
|
18
|
+
* Uses spawnSync to avoid shell parsing issues with special characters
|
|
18
19
|
* @throws Error if the command fails
|
|
19
20
|
*/
|
|
20
21
|
function execGit(args, options) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const result = (0, child_process_1.spawnSync)('git', args, {
|
|
23
|
+
cwd: options?.cwd ?? process.cwd(),
|
|
24
|
+
encoding: 'utf-8',
|
|
25
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
26
|
+
});
|
|
27
|
+
if (result.error) {
|
|
28
|
+
throw result.error;
|
|
29
|
+
}
|
|
30
|
+
if (result.status !== 0) {
|
|
31
|
+
throw new Error(result.stderr || `git command failed with exit code ${result.status}`);
|
|
32
|
+
}
|
|
33
|
+
return (result.stdout || '').trim();
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Check if the current directory is a Git repository
|