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';
33export const FLUSH_PACKET = '0000' ;
44export const PACK_SIGNATURE = 'PACK' ;
55export 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 {
1616 EMPTY_COMMIT_HASH ,
1717 PACK_SIGNATURE ,
1818 PACKET_SIZE ,
19+ GIT_OBJECT_TYPE_COMMIT ,
1920} from '../constants' ;
2021
2122const BitMask = require ( 'bit-mask' ) as any ;
@@ -217,14 +218,17 @@ const isBlankPersonLine = (personLine: PersonLine): boolean => {
217218
218219/**
219220 * Parses the commit data from the contents of a pack file.
221+ *
222+ * Filters out all objects except for commits.
220223 * @param {CommitContent[] } contents - The contents of the pack file.
221224 * @return {CommitData[] } An array of commit data objects.
225+ * @see https://git-scm.com/docs/pack-format#_object_types
222226 */
223227const getCommitData = ( contents : CommitContent [ ] ) : CommitData [ ] => {
224228 console . log ( { contents } ) ;
225229 return lod
226230 . chain ( contents )
227- . filter ( { type : 1 } )
231+ . filter ( { type : GIT_OBJECT_TYPE_COMMIT } )
228232 . map ( ( x : CommitContent ) => {
229233 console . log ( { x } ) ;
230234
You can’t perform that action at this time.
0 commit comments