@lenne.tech/cli 1.51.0 → 1.51.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/build/extensions/git.js +12 -4
- package/package.json +1 -1
package/build/extensions/git.js
CHANGED
|
@@ -189,12 +189,20 @@ class Git {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Get default branch
|
|
192
|
+
* Get the default branch (where `origin/HEAD` points), or `''` when it is not set, so the
|
|
193
|
+
* callers' fallback (`|| 'main'`) applies instead of an exception.
|
|
193
194
|
*/
|
|
194
195
|
getDefaultBranch() {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
// No shell: `basename $(…)` is POSIX syntax, so `lt git get` failed under cmd.exe on Windows.
|
|
198
|
+
try {
|
|
199
|
+
const ref = yield (0, exec_args_1.execArgs)('git', ['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'], { trim: true });
|
|
200
|
+
return ref.slice(ref.lastIndexOf('/') + 1);
|
|
201
|
+
}
|
|
202
|
+
catch (_a) {
|
|
203
|
+
return '';
|
|
204
|
+
}
|
|
205
|
+
});
|
|
198
206
|
}
|
|
199
207
|
/**
|
|
200
208
|
* Get git user
|