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,17 +134,21 @@ 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 ,
138143 show_commit_fn show_commit ,
139144 show_object_fn show_object ,
140145 void * data )
141146{
142147 int i ;
143148 struct commit * commit ;
144- struct object_array objects = { 0 , 0 , NULL };
145149
146150 while ((commit = get_revision (revs )) != NULL ) {
147- process_tree (revs , commit -> tree , & objects , NULL , "" );
151+ add_pending_tree (revs , commit -> tree );
148152 show_commit (commit , data );
149153 }
150154 for (i = 0 ; i < revs -> pending .nr ; i ++ ) {
@@ -155,25 +159,22 @@ void traverse_commit_list(struct rev_info *revs,
155159 continue ;
156160 if (obj -> type == OBJ_TAG ) {
157161 obj -> flags |= SEEN ;
158- add_object_array (obj , name , & objects );
162+ show_object (obj , NULL , name );
159163 continue ;
160164 }
161165 if (obj -> type == OBJ_TREE ) {
162- process_tree (revs , (struct tree * )obj , & objects ,
166+ process_tree (revs , (struct tree * )obj , show_object ,
163167 NULL , name );
164168 continue ;
165169 }
166170 if (obj -> type == OBJ_BLOB ) {
167- process_blob (revs , (struct blob * )obj , & objects ,
171+ process_blob (revs , (struct blob * )obj , show_object ,
168172 NULL , name );
169173 continue ;
170174 }
171175 die ("unknown pending object %s (%s)" ,
172176 sha1_to_hex (obj -> sha1 ), name );
173177 }
174- for (i = 0 ; i < objects .nr ; i ++ )
175- show_object (& objects .objects [i ], data );
176- free (objects .objects );
177178 if (revs -> pending .nr ) {
178179 free (revs -> pending .objects );
179180 revs -> pending .nr = 0 ;
0 commit comments