@@ -178,14 +178,12 @@ describe('parsePackFile', () => {
178
178
const ref = 'refs/heads/main' ;
179
179
const packetLine = `${ oldCommit } ${ newCommit } ${ ref } \0capabilities\n` ;
180
180
181
- const commitContent = `tree 1234567890abcdef1234567890abcdef12345678
182
- parent abcdef1234567890abcdef1234567890abcdef12
183
- author Test Author <[email protected] > 1234567890 +0000
184
- committer Test Committer <[email protected] > 1234567890 +0000
185
-
186
- feat: Add new feature
187
-
188
- This is the commit body.` ;
181
+ const commitContent = "tree 1234567890abcdef1234567890abcdef12345678\n" +
182
+ "parent abcdef1234567890abcdef1234567890abcdef12\n" +
183
+ "author Test Author <[email protected] > 1234567890 +0000\n" +
184
+ "committer Test Committer <[email protected] > 1234567890 +0000\n\n" +
185
+ "feat: Add new feature\n\n" +
186
+ "This is the commit body." ;
189
187
const commitContentBuffer = Buffer . from ( commitContent , 'utf8' ) ;
190
188
191
189
zlibInflateStub . returns ( commitContentBuffer ) ;
@@ -237,11 +235,10 @@ describe('parsePackFile', () => {
237
235
const packetLine = `${ oldCommit } ${ newCommit } ${ ref } \0capabilities\n` ;
238
236
239
237
// Commit content without a parent line
240
- const commitContent = `tree 1234567890abcdef1234567890abcdef12345678
241
- author Test Author <[email protected] > 1234567890 +0000
242
- committer Test Committer <[email protected] > 1234567890 +0100
243
-
244
- feat: Initial commit` ;
238
+ const commitContent = "tree 1234567890abcdef1234567890abcdef12345678\n" +
239
+ "author Test Author <[email protected] > 1234567890 +0000\n" +
240
+ "committer Test Committer <[email protected] > 1234567890 +0100\n\n" +
241
+ "feat: Initial commit" ;
245
242
const parentFromCommit = '0' . repeat ( 40 ) ; // Expected parent hash
246
243
247
244
const commitContentBuffer = Buffer . from ( commitContent , 'utf8' ) ;
@@ -277,13 +274,12 @@ describe('parsePackFile', () => {
277
274
278
275
const parent1 = 'b1' . repeat ( 20 ) ;
279
276
const parent2 = 'b2' . repeat ( 20 ) ;
280
- const commitContent = `tree 1234567890abcdef1234567890abcdef12345678
281
- parent ${ parent1 }
282
- parent ${ parent2 }
283
- author Test Author <[email protected] > 1234567890 +0000
284
- committer Test Committer <[email protected] > 1234567890 +0100
285
-
286
- Merge branch 'feature'` ;
277
+ const commitContent = "tree 1234567890abcdef1234567890abcdef12345678\n" +
278
+ `parent ${ parent1 } \n` +
279
+ `parent ${ parent2 } \n` +
280
+ "author Test Author <[email protected] > 1234567890 +0000\n" +
281
+ "committer Test Committer <[email protected] > 1234567890 +0100\n\n" +
282
+ "Merge branch 'feature'" ;
287
283
288
284
const commitContentBuffer = Buffer . from ( commitContent , 'utf8' ) ;
289
285
zlibInflateStub . returns ( commitContentBuffer ) ;
@@ -315,11 +311,10 @@ describe('parsePackFile', () => {
315
311
const packetLine = `${ oldCommit } ${ newCommit } ${ ref } \0capabilities\n` ;
316
312
317
313
// Malformed commit content - missing tree line
318
- const commitContent = `parent abcdef1234567890abcdef1234567890abcdef12
319
- author Test Author <[email protected] > 1678886400 +0000
320
- committer Test Committer <[email protected] > 1678886460 +0100
321
-
322
- feat: Missing tree` ;
314
+ const commitContent = "parent abcdef1234567890abcdef1234567890abcdef12\n" +
315
+ "author Test Author <[email protected] > 1678886400 +0000\n" +
316
+ "committer Test Committer <[email protected] > 1678886460 +0100\n\n" +
317
+ "feat: Missing tree" ;
323
318
const commitContentBuffer = Buffer . from ( commitContent , 'utf8' ) ;
324
319
zlibInflateStub . returns ( commitContentBuffer ) ;
325
320
@@ -367,12 +362,11 @@ describe('parsePackFile', () => {
367
362
'some other data containing PACK keyword' , // Include "PACK" within a packet line's content
368
363
] ;
369
364
370
- const commitContent = `tree 1234567890abcdef1234567890abcdef12345678
371
- parent ${ oldCommit }
372
- author Test Author <[email protected] > 1234567890 +0000
373
- committer Test Committer <[email protected] > 1234567890 +0000
374
-
375
- Test commit message with PACK inside` ;
365
+ const commitContent = "tree 1234567890abcdef1234567890abcdef12345678\n" +
366
+ `parent ${ oldCommit } \n` +
367
+ "author Test Author <[email protected] > 1234567890 +0000\n" +
368
+ "committer Test Committer <[email protected] > 1234567890 +0000\n\n" +
369
+ "Test commit message with PACK inside" ;
376
370
const samplePackBuffer = createSamplePackBuffer ( 1 , commitContent , 1 ) ;
377
371
378
372
zlibInflateStub . returns ( Buffer . from ( commitContent , 'utf8' ) ) ;
@@ -407,12 +401,11 @@ describe('parsePackFile', () => {
407
401
const ref = 'refs/heads/master' ;
408
402
const packetLines = [ `${ oldCommit } ${ newCommit } ${ ref } \0` ] ;
409
403
410
- const commitContent = `tree 1234567890abcdef1234567890abcdef12345678
411
- parent ${ oldCommit }
412
- author Test Author <[email protected] > 1234567890 +0000
413
- committer Test Committer <[email protected] > 1234567890 +0000
414
-
415
- Commit A` ;
404
+ const commitContent = "tree 1234567890abcdef1234567890abcdef12345678\n" +
405
+ `parent ${ oldCommit } \n` +
406
+ "author Test Author <[email protected] > 1234567890 +0000\n" +
407
+ "committer Test Committer <[email protected] > 1234567890 +0000\n\n" +
408
+ "Commit A" ;
416
409
const samplePackBuffer = createSamplePackBuffer ( 1 , commitContent , 1 ) ;
417
410
zlibInflateStub . returns ( Buffer . from ( commitContent , 'utf8' ) ) ;
418
411
0 commit comments