git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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;
Previous: Jonathan NiederNext: Jonathan Nieder
Message 8 of 9 in “fast-import: fix pack_id corner cases”
  1. 0/3 fast-import: fix pack_id corner casesDmitry Ivankov, Sep 18, 2011
  2. 1/3 fast-import: die if we produce too many (MAX_PACK_ID) packsDmitry Ivankov, Sep 18, 2011
  3. Jonathan NiederSep 18, 2011
  4. 2/3 fast-import: fix corner case for checkpointDmitry Ivankov, Sep 18, 2011
  5. Jonathan NiederSep 18, 2011
  6. 3/3 fast-import: rename object_count to pack_object_countDmitry Ivankov, Sep 18, 2011
  7. Jonathan NiederSep 18, 2011
  8. Dmitry IvankovSep 18, 2011
  9. Jonathan NiederSep 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.