304
write_archive_entry_fn_t write_entry)
305
{
306
struct archiver_context context;
307
- struct unpack_trees_options opts;
308
- struct tree_desc t;
307
int err;
308
struct strbuf path_in_archive = STRBUF_INIT;
309
struct strbuf content = STRBUF_INIT;
329
context.args = args;
330
context.write_entry = write_entry;
331
334
- /*
335
- * Setup index and instruct attr to read index only
336
- */
337
- if (!args->worktree_attributes) {
338
- memset(&opts, 0, sizeof(opts));
339
- opts.index_only = 1;
340
- opts.head_idx = -1;
341
- opts.src_index = args->repo->index;
342
- opts.dst_index = args->repo->index;
343
- opts.fn = oneway_merge;
344
- init_tree_desc(&t, &args->tree->object.oid,
345
- args->tree->buffer, args->tree->size);
346
- if (unpack_trees(1, &t, &opts))
347
- return -1;
348
- git_attr_set_direction(GIT_ATTR_INDEX);
349
- }
350
-
332
err = read_tree(args->repo, args->tree,
333
&args->pathspec,
334
queue_or_write_archive_entry,
521
if (!tree)
522
die(_("not a tree object: %s"), oid_to_hex(&oid));
523
524
+ /*
525
+ * Setup index and instruct attr to read index only
526
+ */
527
+ if (!ar_args->worktree_attributes) {
528
+ struct unpack_trees_options opts;
529
+ struct tree_desc t;
530
+
531
+ memset(&opts, 0, sizeof(opts));
532
+ opts.index_only = 1;
533
+ opts.head_idx = -1;
534
+ opts.src_index = ar_args->repo->index;
535
+ opts.dst_index = ar_args->repo->index;
536
+ opts.fn = oneway_merge;
537
+ init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
538
+ if (unpack_trees(1, &t, &opts))
539
+ die(_("unable to checkout working tree"));
540
+
541
+ git_attr_set_direction(GIT_ATTR_INDEX);
542
+ }
543
+
544
ar_args->refname = ref;
545
ar_args->tree = tree;
546
ar_args->commit_oid = commit_oid;