File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,16 @@ test('unknown commit hash', () => {
5656 expect ( ! ! latestInfo . error ) . toBe ( true ) ;
5757} ) ;
5858
59+ test ( 'check up to date' , ( ) => {
60+ const mergeInfo = gitCommitInfo ( {
61+ cwd : path . join ( fixtures , 'upToDate' ) ,
62+ commit : '31107b9051efe17e57c583937e027993860b11a9' ,
63+ } ) ;
64+
65+ expect ( mergeInfo . commit ) . toBe ( '31107b9051efe17e57c583937e027993860b11a9' ) ;
66+ expect ( mergeInfo . message ) . toBe ( 'Initial commit' ) ;
67+ } ) ;
68+
5969test ( 'merge conflict - named automatically' , ( ) => {
6070 const mergeInfo = gitCommitInfo ( {
6171 cwd : path . join ( fixtures , 'merge' ) ,
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ const gitCommitInfo = (options: GitCommitInfoOptions = {}): GitCommitInfoResult
3939 const info = stdout
4040 . split ( '\n' )
4141 . filter ( ( entry ) => entry . length !== 0 ) ;
42- const mergeIndex = info [ 1 ] . indexOf ( 'Merge' ) === - 1 ? 0 : 1 ;
42+ const mergeIndex = info [ 1 ] ? .indexOf ( 'Merge' ) === - 1 ? 0 : 1 ;
4343
4444 const hash = ( new RegExp ( regex ) . exec ( info [ 0 ] ) || [ ] ) [ 1 ] ;
4545 const shortHash = hash . slice ( 0 , 7 ) ;
You can’t perform that action at this time.
0 commit comments