Skip to content

Commit

Permalink
Use any default branch instead of master
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Nov 21, 2020
1 parent 1ded9f7 commit 02d3d56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Expand Up @@ -201,6 +201,9 @@ class Degit extends EventEmitter {
async _getHash(repo, cached) {
try {
const refs = await fetchRefs(repo);
if (repo.ref === 'HEAD') {
return refs.find(ref => ref.type === 'HEAD').hash;
}
return this._selectRef(refs, repo.ref);
} catch (err) {
this._warn(err);
Expand Down Expand Up @@ -347,7 +350,7 @@ function parse(src) {
const user = match[4];
const name = match[5].replace(/\.git$/, '');
const subdir = match[6];
const ref = match[7] || 'master';
const ref = match[7] || 'HEAD';

const domain = `${site}.${
site === 'bitbucket' ? 'org' : site === 'git.sr.ht' ? '' : 'com'
Expand Down

0 comments on commit 02d3d56

Please sign in to comment.