Browse Source

Shorten git reference if commit

master
Leo Lamprecht 8 years ago
parent
commit
0ea689c27a
No known key found for this signature in database GPG Key ID: B08517883D5E0E10
  1. 11
      lib/github.js

11
lib/github.js

@ -44,10 +44,15 @@ const splittedURL = fullURL => {
// ...and then remove it from the parts
pathParts.splice(0, 2)
return {
main,
ref: pathParts.length >= 2 ? pathParts[1] : ''
// Assign Git reference
let ref = pathParts.length >= 2 ? pathParts[1] : ''
// Shorten SHA for commits
if (pathParts[0] && pathParts[0] === 'commit') {
ref = ref.substring(0, 7)
}
return {main, ref}
}
export const gitPathParts = main => {

Loading…
Cancel
Save