screw-up 0.10.0 → 0.11.0

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.
@@ -1435,14 +1435,6 @@ const formatVersion = (version) => {
1435
1435
  }
1436
1436
  return result;
1437
1437
  };
1438
- const isGitRepository = async (repositoryPath) => {
1439
- try {
1440
- await git.statusMatrix({ fs, dir: repositoryPath });
1441
- return true;
1442
- } catch (e) {
1443
- return false;
1444
- }
1445
- };
1446
1438
  const getCommit = async (repositoryPath, hash) => {
1447
1439
  try {
1448
1440
  const commit = await git.readCommit({ fs, dir: repositoryPath, oid: hash });
@@ -1609,20 +1601,23 @@ const lookupVersionLabelRecursive = async (cwd, commit, reachedCommits) => {
1609
1601
  };
1610
1602
  const getGitMetadata = async (repositoryPath, checkWorkingDirectoryStatus) => {
1611
1603
  const metadata = {};
1612
- if (!await isGitRepository(repositoryPath)) {
1604
+ let gitRootPath;
1605
+ try {
1606
+ gitRootPath = await git.findRoot({ fs, filepath: repositoryPath });
1607
+ } catch (e) {
1613
1608
  return metadata;
1614
1609
  }
1615
1610
  try {
1616
- const currentCommit = await getCurrentCommit(repositoryPath);
1611
+ const currentCommit = await getCurrentCommit(gitRootPath);
1617
1612
  if (!currentCommit) {
1618
1613
  return metadata;
1619
1614
  }
1620
1615
  const reachedCommits = /* @__PURE__ */ new Map();
1621
- let version = await lookupVersionLabelRecursive(repositoryPath, currentCommit, reachedCommits);
1616
+ let version = await lookupVersionLabelRecursive(gitRootPath, currentCommit, reachedCommits);
1622
1617
  const gitMetadata = { tags: [], branches: [] };
1623
1618
  metadata.git = gitMetadata;
1624
1619
  if (version) {
1625
- const hasModified = checkWorkingDirectoryStatus && await hasModifiedFiles(repositoryPath);
1620
+ const hasModified = checkWorkingDirectoryStatus && await hasModifiedFiles(gitRootPath);
1626
1621
  if (hasModified) {
1627
1622
  version = incrementLastVersionComponent(version);
1628
1623
  }
@@ -1636,9 +1631,9 @@ const getGitMetadata = async (repositoryPath, checkWorkingDirectoryStatus) => {
1636
1631
  date: dayjs(currentCommit.date).format("YYYY-MM-DDTHH:mm:ssZ[Z]"),
1637
1632
  message: currentCommit.message
1638
1633
  };
1639
- const relatedTags = await getRelatedTags(repositoryPath, currentCommit.hash);
1634
+ const relatedTags = await getRelatedTags(gitRootPath, currentCommit.hash);
1640
1635
  gitMetadata.tags = relatedTags.map((tag) => tag.name);
1641
- const relatedBranches = await getRelatedBranches(repositoryPath, currentCommit.hash);
1636
+ const relatedBranches = await getRelatedBranches(gitRootPath, currentCommit.hash);
1642
1637
  gitMetadata.branches = relatedBranches;
1643
1638
  } catch (error) {
1644
1639
  console.warn("Failed to extract git metadata:", error);
@@ -1813,4 +1808,4 @@ export {
1813
1808
  resolveRawPackageJsonObject as a,
1814
1809
  resolvePackageMetadata as r
1815
1810
  };
1816
- //# sourceMappingURL=internal-CzKyZ9wb.js.map
1811
+ //# sourceMappingURL=internal-D-ECO0sh.js.map