31
#include "packfile.h"
32
#include "object-store.h"
33
34
+#define IN_PACK(obj) oe_in_pack(&to_pack, obj)
35
+
36
static const char *pack_usage[] = {
37
N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"),
38
N_("git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"),
369
static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
370
unsigned long limit, int usable_delta)
371
{
370
- struct packed_git *p = entry->in_pack;
372
+ struct packed_git *p = IN_PACK(entry);
373
struct pack_window *w_curs = NULL;
374
struct revindex_entry *revidx;
375
off_t offset;
480
481
if (!reuse_object)
482
to_reuse = 0; /* explicit */
481
- else if (!entry->in_pack)
483
+ else if (!IN_PACK(entry))
484
to_reuse = 0; /* can't reuse what we don't have */
485
else if (oe_type(entry) == OBJ_REF_DELTA ||
486
oe_type(entry) == OBJ_OFS_DELTA)
1076
else
1077
nr_result++;
1078
if (found_pack) {
1077
- entry->in_pack = found_pack;
1079
+ oe_set_in_pack(&to_pack, entry, found_pack);
1080
entry->in_pack_offset = found_offset;
1081
}
1082
1401
1402
static void check_object(struct object_entry *entry)
1403
{
1402
- if (entry->in_pack) {
1403
- struct packed_git *p = entry->in_pack;
1404
+ if (IN_PACK(entry)) {
1405
+ struct packed_git *p = IN_PACK(entry);
1406
struct pack_window *w_curs = NULL;
1407
const unsigned char *base_ref = NULL;
1408
struct object_entry *base_entry;
1537
{
1538
const struct object_entry *a = *(struct object_entry **)_a;
1539
const struct object_entry *b = *(struct object_entry **)_b;
1540
+ const struct packed_git *a_in_pack = IN_PACK(a);
1541
+ const struct packed_git *b_in_pack = IN_PACK(b);
1542
1543
/* avoid filesystem trashing with loose objects */
1540
- if (!a->in_pack && !b->in_pack)
1544
+ if (!a_in_pack && !b_in_pack)
1545
return oidcmp(&a->idx.oid, &b->idx.oid);
1546
1543
- if (a->in_pack < b->in_pack)
1547
+ if (a_in_pack < b_in_pack)
1548
return -1;
1545
- if (a->in_pack > b->in_pack)
1549
+ if (a_in_pack > b_in_pack)
1550
return 1;
1551
return a->in_pack_offset < b->in_pack_offset ? -1 :
1552
(a->in_pack_offset > b->in_pack_offset);
1582
1583
oi.sizep = &entry->size;
1584
oi.typep = &type;
1581
- if (packed_object_info(entry->in_pack, entry->in_pack_offset, &oi) < 0) {
1585
+ if (packed_object_info(IN_PACK(entry), entry->in_pack_offset, &oi) < 0) {
1586
/*
1587
* We failed to get the info from this pack for some reason;
1588
* fall back to sha1_object_info, which may find another copy.
1852
* it, we will still save the transfer cost, as we already know
1853
* the other side has it and we won't send src_entry at all.
1854
*/
1851
- if (reuse_delta && trg_entry->in_pack &&
1852
- trg_entry->in_pack == src_entry->in_pack &&
1855
+ if (reuse_delta && IN_PACK(trg_entry) &&
1856
+ IN_PACK(trg_entry) == IN_PACK(src_entry) &&
1857
!src_entry->preferred_base &&
1858
trg_entry->in_pack_type != OBJ_REF_DELTA &&
1859
trg_entry->in_pack_type != OBJ_OFS_DELTA)
3196
}
3197
}
3198
3199
+ prepare_packing_data(&to_pack);
3200
+
3201
if (progress)
3202
progress_state = start_progress(_("Counting objects"), 0);
3203
if (!use_internal_rev_list)