@@ -4,7 +4,7 @@ const patchDiffRegex = /[.](patch|diff)$/;
4
4
const releaseRegex = / ^ r e l e a s e s [ / ] t a g [ / ] ( [ ^ / ] + ) / ;
5
5
const labelRegex = / ^ l a b e l s [ / ] ( [ ^ / ] + ) / ;
6
6
const compareRegex = / ^ c o m p a r e [ / ] ( [ ^ / ] + ) / ;
7
- const pullRegex = / ^ p u l l [ / ] ( \d + ) [ / ] ( [ ^ / ] + ) $ / ;
7
+ const pullRegex = / ^ p u l l [ / ] ( \d + ) [ / ] ( [ ^ / ] + ) (?: [ / ] ( [ \d a - f ] { 40 } ) [ . ] [ . ] ( [ \d a - f ] { 40 } ) ) ? $ / ;
8
8
const releaseArchiveRegex = / ^ a r c h i v e [ / ] ( .+ ) ( [ . ] z i p | [ . ] t a r [ . ] g z ) / ;
9
9
const releaseDownloadRegex = / ^ r e l e a s e s [ / ] d o w n l o a d [ / ] ( [ ^ / ] + ) [ / ] ( .+ ) / ;
10
10
const dependentsRegex = / ^ n e t w o r k [ / ] d e p e n d e n t s [ / ] ? $ / ;
@@ -90,7 +90,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
90
90
const [ , downloadTag , downloadFilename ] = repoPath . match ( releaseDownloadRegex ) || [ ] ;
91
91
const [ , label ] = repoPath . match ( labelRegex ) || [ ] ;
92
92
const [ , compare ] = repoPath . match ( compareRegex ) || [ ] ;
93
- const [ , pull , pullPage ] = repoPath . match ( pullRegex ) || [ ] ;
93
+ const [ , pull , pullPage , pullPartialStart , pullPartialEnd ] = repoPath . match ( pullRegex ) || [ ] ;
94
94
const isFileOrDir = revision && [
95
95
'raw' ,
96
96
'tree' ,
@@ -164,8 +164,14 @@ function shortenURL(href, currentUrl = 'https://github.com') {
164
164
return `${ user } /${ repo } (dependencies)` ;
165
165
}
166
166
167
- if ( pull && pullPage ) {
168
- return `${ repoUrl } #${ pull } (${ pullPage } )` ;
167
+ if ( pull ) {
168
+ if ( pullPage === 'files' && pullPartialStart && pullPartialEnd ) {
169
+ return `<code>${ pullPartialStart . slice ( 0 , 8 ) } ..${ pullPartialEnd . slice ( 0 , 8 ) } </code> (#${ pull } )` ;
170
+ }
171
+
172
+ if ( pullPage ) {
173
+ return `${ repoUrl } #${ pull } (${ pullPage } )` ;
174
+ }
169
175
}
170
176
171
177
if ( compare ) {
0 commit comments