Commit fa5f625d authored by Dan Allen's avatar Dan Allen
Browse files

skip check for local branches in managed repository

parent d6f734dd
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ This project utilizes semantic versioning.
* *playbook-builder*: Rework `buildPlaybook` so it only processes args and env once
* *playbook-builder*: Use YAML serialization internally for map and primitive-map values read from arguments (i.e., CLI options)
* *content-aggregator*: Skip check for remote branches in non-managed repository with no remote (#1179)
* *content-aggregator*: Skip check for local branches in managed repository (#1111)
* *page-composer*: `resolvePage` and `resolvePageURL` helpers resolve current page when called with no arguments (#1166)
* *page-composer*: Populate breadcrumbs for orphan page when component version has no navigation (#1176)
* *site-generator*: Log warning (instead of crashing) if Antora extension in playbook is missing require key (#1177)
+7 −15
Original line number Diff line number Diff line
@@ -373,31 +373,22 @@ async function selectReferences (source, repo, remote) {
      }
    }
  }
  let preferRemote = false
  // NOTE isomorphic-git includes HEAD in list of remote branches (see https://isomorphic-git.org/docs/listBranches)
  const remoteBranches = remote
    ? (await git.listBranches(Object.assign({ remote }, repo))).filter((it) => it !== 'HEAD')
    : []
  if (remoteBranches.length) {
    if (isBare) preferRemote = true
    for (const shortname of filterRefs(remoteBranches, branchPatterns, patternCache)) {
      const fullname = 'remotes/' + remote + '/' + shortname
      refs.set(shortname, { shortname, fullname, type: 'branch', remote, head: noWorktree })
    }
  }
  if (!managed) {
    const localBranches = await git.listBranches(repo).then((branches) => {
      if (branches.length || isBare) return branches
      if (currentBranch != null) return [currentBranch]
      return getCurrentBranchName(repo).then((branch) => (branch ? [branch] : []))
    })
  if (managed) {
    if (localBranches.length) {
      for (const shortname of filterRefs(localBranches, branchPatterns, patternCache)) {
        if (preferRemote && refs.has(shortname)) continue
        refs.set(shortname, { shortname, fullname: 'heads/' + shortname, type: 'branch', head: undefined })
      }
    }
  } else {
    const worktrees = await findWorktrees(repo, worktreePatterns)
    let onMatch
    if ((worktreePatterns.join('') || '.') !== '.') {
@@ -412,6 +403,7 @@ async function selectReferences (source, repo, remote) {
      }
    }
    if (localBranches.length) {
      const preferRemote = isBare && remoteBranches.length > 0
      for (const shortname of filterRefs(localBranches, branchPatterns, patternCache, onMatch)) {
        if (preferRemote && refs.has(shortname)) continue
        const head = (worktrees.get(shortname) || { head: false }).head