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

Re: [PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()

From
DHDana How <danahow@gmail.com>
Date
May 1, 2007, 05:24 UTC
Message-ID
<56b7f5510704302224r637788fela543df5eaad2317d@mail.gmail.com>
In-Reply-To
<20070501050155.GY5942@spearce.org>
On 4/30/07, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 24 quoted lines
> Dana How <danahow@gmail.com> wrote:
> > sha1close() flushes, writes checksum, and closes.
> > The 2nd can be suppressed; make the last suppressible as well.
> ...
> > diff --git a/csum-file.c b/csum-file.c
> > --- a/csum-file.c
> > +++ b/csum-file.c
> > @@ -35,7 +35,10 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
> > +             f->offset = 0;
> >       }
> > +     if (update < 0)
> > +             return 0;       /* only want to flush (no checksum write, no close) */
>
> Huh.  Nobody currently uses that update parameter; all current in-tree
> callers (which better be *all* callers since we don't have a true
> libgit!) seem to always pass a 1 for this argument.  This makes the
> later:
>
>   if (update)
>     sha1flush(f, 20);
>
> always true anytime sha1close is called.  Maybe we should be
> redefining that update argument to be 1 means do all work, 0 means
> return where you return update < 0 above?

Considering I had to look at all the sha1close call sites to confirm -1 was a safe new value, I should have reached your conclusion as well. But I was really trying to focus on additions, not alterations.

I'll either roll this into my next patchset (also in pack-objects), or include it in any other changes to this patchset if any.

Thanks,
-- 
Dana L. How  danahow@gmail.com  +1 650 804 5991 cell
Previous: Shawn O. Pearce
Message 3 of 3 in “git-repack --max-pack-size: make close optional in sha1close()”
  1. 3/8 git-repack --max-pack-size: make close optional in sha1close()Dana How, Apr 30, 2007
  2. Shawn O. PearceMay 1, 2007
  3. Dana HowMay 1, 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.