@simbo/git-exec 1.0.0 → 1.0.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/CHANGELOG.md +10 -0
- package/README.md +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @simbo/git-exec
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0bbde2e: Document when `GitError.exitCode` is `undefined`.
|
|
8
|
+
|
|
9
|
+
- The README explains that `exitCode` is `undefined` when Git could not be
|
|
10
|
+
started, was terminated by a signal, or exceeded `maxBuffer`.
|
|
11
|
+
- An example shows how to tell a failed command from a Git that could not run.
|
|
12
|
+
|
|
3
13
|
## 1.0.0
|
|
4
14
|
|
|
5
15
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -80,6 +80,22 @@ try {
|
|
|
80
80
|
exits with a non-zero code, is terminated, or exceeds `maxBuffer`. The message
|
|
81
81
|
contains the command, the reason, and the standard error output.
|
|
82
82
|
|
|
83
|
+
`exitCode` holds the exit code when Git exited on its own. It is `undefined`
|
|
84
|
+
when Git could not be started, was terminated by a signal, or was stopped for
|
|
85
|
+
exceeding `maxBuffer`. Check it to tell a failed command from a Git that could
|
|
86
|
+
not run:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
try {
|
|
90
|
+
await git(['fetch', 'origin'], { cwd: root });
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (error instanceof GitError && error.exitCode === undefined) {
|
|
93
|
+
throw error; // Git did not run to completion
|
|
94
|
+
}
|
|
95
|
+
// Git ran and reported a failure
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
83
99
|
`gitSucceeds()` returns `false` only for a non-zero exit code. If Git cannot run
|
|
84
100
|
at all, it rejects, so that a missing Git or working directory is not mistaken
|
|
85
101
|
for a failed check.
|