@antora/content-aggregator 3.1.3 → 3.1.5

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.
@@ -274,9 +274,10 @@ async function collectFilesFromSource (source, repo, remoteName, authStatus) {
274
274
  // QUESTION should we resolve HEAD to a ref eagerly to avoid having to do a match on it?
275
275
  async function selectReferences (source, repo, remote) {
276
276
  let { branches: branchPatterns, tags: tagPatterns, worktrees: worktreePatterns = '.' } = source
277
- const isBare = repo.noCheckout
277
+ const managed = 'url' in repo
278
+ const isBare = managed || repo.noCheckout
278
279
  const patternCache = repo.cache[REF_PATTERN_CACHE_KEY]
279
- const noWorktree = repo.url ? undefined : false
280
+ const noWorktree = managed ? undefined : false
280
281
  const refs = new Map()
281
282
  if (
282
283
  tagPatterns &&
@@ -369,10 +370,11 @@ async function selectReferences (source, repo, remote) {
369
370
  refs.set(shortname, { shortname, fullname: 'heads/' + shortname, type: 'branch', head })
370
371
  }
371
372
  }
372
- } else if (!remoteBranches.length) {
373
+ } else if (!managed || !remoteBranches.length) {
373
374
  const localBranches = await git.listBranches(repo)
374
375
  if (localBranches.length) {
375
376
  for (const shortname of filterRefs(localBranches, branchPatterns, patternCache)) {
377
+ if (refs.has(shortname)) continue // NOTE prefer remote branches in bare repository
376
378
  refs.set(shortname, { shortname, fullname: 'heads/' + shortname, type: 'branch', head: noWorktree })
377
379
  }
378
380
  }
@@ -826,9 +828,12 @@ function onGitComplete (err) {
826
828
 
827
829
  function resolveCredentials (credentialsFromUrlHolder, url, auth) {
828
830
  const credentialsFromUrl = credentialsFromUrlHolder.get() || {}
829
- credentialsFromUrlHolder.clear()
830
831
  if ('Authorization' in auth.headers) {
831
- if (!('username' in credentialsFromUrl)) return this.rejected({ url, auth })
832
+ if ('username' in credentialsFromUrl) {
833
+ credentialsFromUrlHolder.clear()
834
+ } else {
835
+ return this.rejected({ url, auth })
836
+ }
832
837
  } else if ('username' in credentialsFromUrl) {
833
838
  return credentialsFromUrl
834
839
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-aggregator",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@antora/expand-path-helper": "~2.0",
32
- "@antora/logger": "3.1.3",
32
+ "@antora/logger": "3.1.5",
33
33
  "@antora/user-require-helper": "~2.0",
34
34
  "braces": "~3.0",
35
35
  "cache-directory": "~2.0",
36
36
  "glob-stream": "~7.0",
37
- "hpagent": "~1.1",
37
+ "hpagent": "~1.2",
38
38
  "isomorphic-git": "~1.21",
39
39
  "js-yaml": "~4.1",
40
40
  "multi-progress": "~4.0",
@@ -62,7 +62,7 @@
62
62
  ],
63
63
  "scripts": {
64
64
  "test": "_mocha",
65
- "prepublishOnly": "node $npm_config_local_prefix/npm/prepublishOnly.js",
66
- "postpublish": "node $npm_config_local_prefix/npm/postpublish.js"
65
+ "prepublishOnly": "npx -y downdoc --prepublish",
66
+ "postpublish": "npx -y downdoc --postpublish"
67
67
  }
68
68
  }