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

Re: [PATCH] Enhance unpack-objects for extracting large objects

From
Nicolas Pitre <nico@cam.org>
Date
May 25, 2007, 19:52 UTC
Message-ID
<alpine.LFD.0.99.0705251546260.3366@xanadu.home>
In-Reply-To
<7vsl9kr9mz.fsf@assigned-by-dhcp.cox.net>
On Fri, 25 May 2007, Junio C Hamano wrote:
Show 5 quoted lines
> Maybe we would want to call it '-f' for consistency.  Another
> possibility is the other way around, giving others a longer
> synonyms, like --quiet, but this command is plumbing and I do
> not think long options matters that much, so my preference is to
> do '-f' not '--force'.

OTOH, I like to have long options for weird or obscur parameters. Their action is less likely to be presumed by casual inspection of a script using them. I don't feel strongly about it either ways though.

Show 26 quoted lines
> > @@ -131,7 +134,9 @@ static void added_object(unsigned nr, enum object_type type,
> >  static void write_object(unsigned nr, enum object_type type,
> >  			 void *buf, unsigned long size)
> >  {
> > -	if (write_sha1_file(buf, size, typename(type), obj_list[nr].sha1) < 0)
> > +	int force2 = size < min_blob_size ? -1 : force;
> > +	if (write_sha1_file_maybe(buf, size, typename(type),
> > +				  force2, obj_list[nr].sha1) < 0)
> >  		die("failed to write object");
> >  	added_object(nr, type, buf, size);
> >  }
> 
> Without --min-blob-size option, min_blob_size is initialized to
> 0u and force2 always gets the value of force.  With the option,
> blobs smaller than the threshold gets -1 and otherwise the value
> of force.
> 
> "write_sha1_file_maybe()" can take 0, 1, or -1 as its fourth
> parameter.  The reader is left puzzled what the distinction
> among these three and decides to read on to figure it out before
> complaining too much about the code, but no matter what it does,
> doesn't the above logic already feel wrong?
> 
>  * You already have the size here, so if min_blob_size is set
>    and the size is larger, you do not even have to call
>    write_sha1_file() at all.
You still do to get the object's SHA1.
Nicolas
Previous: Nicolas Pitre
Message 7 of 7 in “Enhance unpack-objects for extracting large objects”
  1. Enhance unpack-objects for extracting large objectsDana How, May 25, 2007
  2. Nicolas PitreMay 25, 2007
  3. Junio C HamanoMay 25, 2007
  4. Dana HowMay 25, 2007
  5. Junio C HamanoMay 25, 2007
  6. Nicolas PitreMay 25, 2007
  7. Nicolas PitreMay 25, 2007

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.