@@ -94,17 +94,53 @@ static void process_gitlink(struct traversal_context *ctx,
94
94
/* Nothing to do */
95
95
}
96
96
97
+ static void process_tree (struct traversal_context * ctx ,
98
+ struct tree * tree ,
99
+ struct strbuf * base ,
100
+ const char * name );
101
+
102
+ static void process_tree_contents (struct traversal_context * ctx ,
103
+ struct tree * tree ,
104
+ struct strbuf * base )
105
+ {
106
+ struct tree_desc desc ;
107
+ struct name_entry entry ;
108
+ enum interesting match = ctx -> revs -> diffopt .pathspec .nr == 0 ?
109
+ all_entries_interesting : entry_not_interesting ;
110
+
111
+ init_tree_desc (& desc , tree -> buffer , tree -> size );
112
+
113
+ while (tree_entry (& desc , & entry )) {
114
+ if (match != all_entries_interesting ) {
115
+ match = tree_entry_interesting (& entry , base , 0 ,
116
+ & ctx -> revs -> diffopt .pathspec );
117
+ if (match == all_entries_not_interesting )
118
+ break ;
119
+ if (match == entry_not_interesting )
120
+ continue ;
121
+ }
122
+
123
+ if (S_ISDIR (entry .mode ))
124
+ process_tree (ctx ,
125
+ lookup_tree (the_repository , entry .oid ),
126
+ base , entry .path );
127
+ else if (S_ISGITLINK (entry .mode ))
128
+ process_gitlink (ctx , entry .oid -> hash ,
129
+ base , entry .path );
130
+ else
131
+ process_blob (ctx ,
132
+ lookup_blob (the_repository , entry .oid ),
133
+ base , entry .path );
134
+ }
135
+ }
136
+
97
137
static void process_tree (struct traversal_context * ctx ,
98
138
struct tree * tree ,
99
139
struct strbuf * base ,
100
140
const char * name )
101
141
{
102
142
struct object * obj = & tree -> object ;
103
143
struct rev_info * revs = ctx -> revs ;
104
- struct tree_desc desc ;
105
- struct name_entry entry ;
106
- enum interesting match = revs -> diffopt .pathspec .nr == 0 ?
107
- all_entries_interesting : entry_not_interesting ;
108
144
int baselen = base -> len ;
109
145
enum list_objects_filter_result r = LOFR_MARK_SEEN | LOFR_DO_SHOW ;
110
146
int gently = revs -> ignore_missing_links ||
@@ -144,29 +180,7 @@ static void process_tree(struct traversal_context *ctx,
144
180
if (base -> len )
145
181
strbuf_addch (base , '/' );
146
182
147
- init_tree_desc (& desc , tree -> buffer , tree -> size );
148
-
149
- while (tree_entry (& desc , & entry )) {
150
- if (match != all_entries_interesting ) {
151
- match = tree_entry_interesting (& entry , base , 0 ,
152
- & revs -> diffopt .pathspec );
153
- if (match == all_entries_not_interesting )
154
- break ;
155
- if (match == entry_not_interesting )
156
- continue ;
157
- }
158
-
159
- if (S_ISDIR (entry .mode ))
160
- process_tree (ctx ,
161
- lookup_tree (the_repository , entry .oid ),
162
- base , entry .path );
163
- else if (S_ISGITLINK (entry .mode ))
164
- process_gitlink (ctx , entry .oid -> hash , base , entry .path );
165
- else
166
- process_blob (ctx ,
167
- lookup_blob (the_repository , entry .oid ),
168
- base , entry .path );
169
- }
183
+ process_tree_contents (ctx , tree , base );
170
184
171
185
if (!(obj -> flags & USER_GIVEN ) && ctx -> filter_fn ) {
172
186
r = ctx -> filter_fn (LOFS_END_TREE , obj ,
0 commit comments