173
return recurse;
174
}
175
176
-static int show_tree_common(struct show_tree_data *data, int *recurse,
177
- const struct object_id *oid, struct strbuf *base,
178
- const char *pathname, unsigned mode)
176
+static int show_tree_common(int *recurse, struct strbuf *base,
177
+ const char *pathname, enum object_type type)
178
{
180
- enum object_type type = object_type(mode);
179
int ret = -1;
182
-
180
*recurse = 0;
184
- data->mode = mode;
185
- data->type = type;
186
- data->oid = oid;
187
- data->pathname = pathname;
188
- data->base = base;
181
182
if (type == OBJ_BLOB) {
183
if (ls_options & LS_TREE_ONLY)
209
{
210
int early;
211
int recurse;
220
- struct show_tree_data data = { 0 };
212
+ enum object_type type = object_type(mode);
213
222
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
214
+ early = show_tree_common(&recurse, base, pathname, type);
215
if (early >= 0)
216
return early;
217
226
- printf("%06o %s %s\t", data.mode, type_name(data.type),
227
- find_unique_abbrev(data.oid, abbrev));
228
- show_tree_common_default_long(base, pathname, data.base->len);
218
+ printf("%06o %s %s\t", mode, type_name(object_type(mode)),
219
+ find_unique_abbrev(oid, abbrev));
220
+ show_tree_common_default_long(base, pathname, base->len);
221
return recurse;
222
}
223
227
{
228
int early;
229
int recurse;
238
- struct show_tree_data data = { 0 };
230
char size_text[24];
231
+ enum object_type type = object_type(mode);
232
241
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
233
+ early = show_tree_common(&recurse, base, pathname, type);
234
if (early >= 0)
235
return early;
236
245
- if (data.type == OBJ_BLOB) {
237
+ if (type == OBJ_BLOB) {
238
unsigned long size;
247
- if (oid_object_info(the_repository, data.oid, &size) == OBJ_BAD)
239
+ if (oid_object_info(the_repository, oid, &size) == OBJ_BAD)
240
xsnprintf(size_text, sizeof(size_text), "BAD");
241
else
242
xsnprintf(size_text, sizeof(size_text),
245
xsnprintf(size_text, sizeof(size_text), "-");
246
}
247
256
- printf("%06o %s %s %7s\t", data.mode, type_name(data.type),
257
- find_unique_abbrev(data.oid, abbrev), size_text);
258
- show_tree_common_default_long(base, pathname, data.base->len);
248
+ printf("%06o %s %s %7s\t", mode, type_name(type),
249
+ find_unique_abbrev(oid, abbrev), size_text);
250
+ show_tree_common_default_long(base, pathname, base->len);
251
return recurse;
252
}
253
258
int early;
259
int recurse;
260
const size_t baselen = base->len;
269
- struct show_tree_data data = { 0 };
261
+ enum object_type type = object_type(mode);
262
271
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
263
+ early = show_tree_common(&recurse, base, pathname, type);
264
if (early >= 0)
265
return early;
266
278
{
279
int early;
280
int recurse;
289
- struct show_tree_data data = { 0 };
281
+ enum object_type type = object_type(mode);
282
291
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
283
+ early = show_tree_common(&recurse, base, pathname, type);
284
if (early >= 0)
285
return early;
286