azdo-cli 0.5.0-025-multi-org-support.459 → 0.5.0-025-multi-org-support.463
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/index.js +14 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -810,7 +810,7 @@ async function status() {
|
|
|
810
810
|
}
|
|
811
811
|
|
|
812
812
|
// src/services/git-remote.ts
|
|
813
|
-
import {
|
|
813
|
+
import { execFileSync } from "child_process";
|
|
814
814
|
import fs from "fs";
|
|
815
815
|
import path from "path";
|
|
816
816
|
|
|
@@ -832,6 +832,17 @@ function noticeCredentialBearingRemote(remoteName = "origin") {
|
|
|
832
832
|
}
|
|
833
833
|
|
|
834
834
|
// src/services/git-remote.ts
|
|
835
|
+
var GIT_BINARY = (() => {
|
|
836
|
+
const known = process.platform === "win32" ? ["C:\\Program Files\\Git\\bin\\git.exe", "C:\\Program Files (x86)\\Git\\bin\\git.exe"] : ["/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git"];
|
|
837
|
+
return known.find((p) => {
|
|
838
|
+
try {
|
|
839
|
+
execFileSync(p, ["--version"], { stdio: "ignore" });
|
|
840
|
+
return true;
|
|
841
|
+
} catch {
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
}) ?? "git";
|
|
845
|
+
})();
|
|
835
846
|
var patterns = [
|
|
836
847
|
// HTTPS (current): https://[user[:token]@]dev.azure.com/{org}/{project}/_git/{repo}[.git]
|
|
837
848
|
/^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+?)(?:\.git)?$/,
|
|
@@ -985,7 +996,7 @@ function parseRepoName(url) {
|
|
|
985
996
|
function detectRepoName() {
|
|
986
997
|
let remoteUrl;
|
|
987
998
|
try {
|
|
988
|
-
remoteUrl =
|
|
999
|
+
remoteUrl = execFileSync(GIT_BINARY, ["remote", "get-url", "origin"], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
989
1000
|
} catch {
|
|
990
1001
|
throw new Error('Not in a git repository. Check that git remote "origin" exists and try again.');
|
|
991
1002
|
}
|
|
@@ -996,7 +1007,7 @@ function detectRepoName() {
|
|
|
996
1007
|
return repo;
|
|
997
1008
|
}
|
|
998
1009
|
function getCurrentBranch() {
|
|
999
|
-
const branch =
|
|
1010
|
+
const branch = execFileSync(GIT_BINARY, ["rev-parse", "--abbrev-ref", "HEAD"], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
1000
1011
|
if (branch === "HEAD") {
|
|
1001
1012
|
throw new Error("Not on a named branch. Check out a named branch and try again.");
|
|
1002
1013
|
}
|