File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ export const EMPTY_COMMIT_HASH = '0000000000000000000000000000000000000000';
3
3
export const FLUSH_PACKET = '0000' ;
4
4
export const PACK_SIGNATURE = 'PACK' ;
5
5
export const PACKET_SIZE = 4 ;
6
+ export const GIT_OBJECT_TYPE_COMMIT = 1 ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
EMPTY_COMMIT_HASH ,
17
17
PACK_SIGNATURE ,
18
18
PACKET_SIZE ,
19
+ GIT_OBJECT_TYPE_COMMIT ,
19
20
} from '../constants' ;
20
21
21
22
const BitMask = require ( 'bit-mask' ) as any ;
@@ -217,14 +218,17 @@ const isBlankPersonLine = (personLine: PersonLine): boolean => {
217
218
218
219
/**
219
220
* Parses the commit data from the contents of a pack file.
221
+ *
222
+ * Filters out all objects except for commits.
220
223
* @param {CommitContent[] } contents - The contents of the pack file.
221
224
* @return {CommitData[] } An array of commit data objects.
225
+ * @see https://git-scm.com/docs/pack-format#_object_types
222
226
*/
223
227
const getCommitData = ( contents : CommitContent [ ] ) : CommitData [ ] => {
224
228
console . log ( { contents } ) ;
225
229
return lod
226
230
. chain ( contents )
227
- . filter ( { type : 1 } )
231
+ . filter ( { type : GIT_OBJECT_TYPE_COMMIT } )
228
232
. map ( ( x : CommitContent ) => {
229
233
console . log ( { x } ) ;
230
234
You can’t perform that action at this time.
0 commit comments