Re: [PATCH 3/3] fast-import: rename object_count to pack_object_count
- From
Dmitry Ivankov <divanorama@gmail.com>
- Date
- Sep 18, 2011, 19:51 UTC
- Message-ID
- <CA+gfSn8aOWPm=xmTE9WzuXsQY0EfYypFxRAyVb-x3_kmhNUb-Q@mail.gmail.com>
- In-Reply-To
- <20110918193205.GF2308@elie>
On Mon, Sep 19, 2011 at 1:32 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 16 quoted lines
> Dmitry Ivankov wrote: > >> object_count is used to count objects that'll go to the current pack. >> While object_count_by_* are used to count total amount of objects and >> are not used to determine if current packfile is empty. >> >> Rename (and move declaration) object_count to pack_object_count to >> avoid possible confusion. > > No strong opinion on this one. I guess the important thing is that > you are moving the declaration to the group of declarations labelled as > > /* The .pack file being generated */ > > . Is it important to rename the variable while at it (which will > disrupt other patches in flight using that variable if they exist)?
Not that important. Maybe a huge comment will do more and better. object_count++ still appears near object_count_by_type[type]++, but hopefully one will look for their declarations and thus avoid the confusion.
--- a/fast-import.c +++ b/fast-import.c @@ -290,7 +290,6 @@ static uintmax_t object_count_by_type[1 << TYPE_BITS]; static uintmax_t duplicate_count_by_type[1 << TYPE_BITS]; static uintmax_t delta_count_by_type[1 << TYPE_BITS]; static uintmax_t delta_count_attempts_by_type[1 << TYPE_BITS]; -static unsigned long object_count; static unsigned long branch_count; static unsigned long branch_load_count; static int failure; @@ -310,8 +309,16 @@ static unsigned int atom_cnt; static struct atom_str **atom_table; /* The .pack file being generated */ +/* + * objects that are being written to the current pack + * all *must* have current pack_id in struct object_entry. + * And object_count *must* be a count of object_entry's + * having current pack_id. This data is used to create + * index file once current pack_file is finished. + */ static struct pack_idx_option pack_idx_opts; static unsigned int pack_id; +static unsigned long object_count; static struct sha1file *pack_file; static struct packed_git *pack_data; static struct packed_git **all_packs;