1010
1111static void process_blob (struct rev_info * revs ,
1212 struct blob * blob ,
13- struct object_array * p ,
13+ show_object_fn show ,
1414 struct name_path * path ,
1515 const char * name )
1616{
@@ -23,7 +23,7 @@ static void process_blob(struct rev_info *revs,
2323 if (obj -> flags & (UNINTERESTING | SEEN ))
2424 return ;
2525 obj -> flags |= SEEN ;
26- add_object (obj , p , path , name );
26+ show (obj , path , name );
2727}
2828
2929/*
@@ -50,7 +50,7 @@ static void process_blob(struct rev_info *revs,
5050 */
5151static void process_gitlink (struct rev_info * revs ,
5252 const unsigned char * sha1 ,
53- struct object_array * p ,
53+ show_object_fn show ,
5454 struct name_path * path ,
5555 const char * name )
5656{
@@ -59,7 +59,7 @@ static void process_gitlink(struct rev_info *revs,
5959
6060static void process_tree (struct rev_info * revs ,
6161 struct tree * tree ,
62- struct object_array * p ,
62+ show_object_fn show ,
6363 struct name_path * path ,
6464 const char * name )
6565{
@@ -77,7 +77,7 @@ static void process_tree(struct rev_info *revs,
7777 if (parse_tree (tree ) < 0 )
7878 die ("bad tree object %s" , sha1_to_hex (obj -> sha1 ));
7979 obj -> flags |= SEEN ;
80- add_object (obj , p , path , name );
80+ show (obj , path , name );
8181 me .up = path ;
8282 me .elem = name ;
8383 me .elem_len = strlen (name );
@@ -88,14 +88,14 @@ static void process_tree(struct rev_info *revs,
8888 if (S_ISDIR (entry .mode ))
8989 process_tree (revs ,
9090 lookup_tree (entry .sha1 ),
91- p , & me , entry .path );
91+ show , & me , entry .path );
9292 else if (S_ISGITLINK (entry .mode ))
9393 process_gitlink (revs , entry .sha1 ,
94- p , & me , entry .path );
94+ show , & me , entry .path );
9595 else
9696 process_blob (revs ,
9797 lookup_blob (entry .sha1 ),
98- p , & me , entry .path );
98+ show , & me , entry .path );
9999 }
100100 free (tree -> buffer );
101101 tree -> buffer = NULL ;
@@ -134,16 +134,20 @@ void mark_edges_uninteresting(struct commit_list *list,
134134 }
135135}
136136
137+ static void add_pending_tree (struct rev_info * revs , struct tree * tree )
138+ {
139+ add_pending_object (revs , & tree -> object , "" );
140+ }
141+
137142void traverse_commit_list (struct rev_info * revs ,
138- void ( * show_commit )( struct commit * ) ,
139- void ( * show_object )( struct object_array_entry * ) )
143+ show_commit_fn show_commit ,
144+ show_object_fn show_object )
140145{
141146 int i ;
142147 struct commit * commit ;
143- struct object_array objects = { 0 , 0 , NULL };
144148
145149 while ((commit = get_revision (revs )) != NULL ) {
146- process_tree (revs , commit -> tree , & objects , NULL , "" );
150+ add_pending_tree (revs , commit -> tree );
147151 show_commit (commit );
148152 }
149153 for (i = 0 ; i < revs -> pending .nr ; i ++ ) {
@@ -154,25 +158,22 @@ void traverse_commit_list(struct rev_info *revs,
154158 continue ;
155159 if (obj -> type == OBJ_TAG ) {
156160 obj -> flags |= SEEN ;
157- add_object_array (obj , name , & objects );
161+ show_object (obj , NULL , name );
158162 continue ;
159163 }
160164 if (obj -> type == OBJ_TREE ) {
161- process_tree (revs , (struct tree * )obj , & objects ,
165+ process_tree (revs , (struct tree * )obj , show_object ,
162166 NULL , name );
163167 continue ;
164168 }
165169 if (obj -> type == OBJ_BLOB ) {
166- process_blob (revs , (struct blob * )obj , & objects ,
170+ process_blob (revs , (struct blob * )obj , show_object ,
167171 NULL , name );
168172 continue ;
169173 }
170174 die ("unknown pending object %s (%s)" ,
171175 sha1_to_hex (obj -> sha1 ), name );
172176 }
173- for (i = 0 ; i < objects .nr ; i ++ )
174- show_object (& objects .objects [i ]);
175- free (objects .objects );
176177 if (revs -> pending .nr ) {
177178 free (revs -> pending .objects );
178179 revs -> pending .nr = 0 ;
0 commit comments