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

Re: [PATCH] builtin/repack.c: remove redundant pack-based bitmaps

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 18, 2022, 02:43 UTC
Message-ID
<Y04Sxb/ysk5tgyvZ@nand.local>
In-Reply-To
<Y02YzYS172skpbAb@coredump.intra.peff.net>
On Mon, Oct 17, 2022 at 02:02:53PM -0400, Jeff King wrote:
Show 8 quoted lines
> > +		if (unlink(path.buf) && errno != ENOENT)
> > +			die_errno(_("could not remove stale bitmap: %s"),
> > +				  path.buf);
>
> We could downgrade this to a warning, since there is no downside to
> retaining those files (aside from wasted space). In
> remove_redundant_pack(), we call into unlink_pack_path(), which just
> ignores unlink errors (though arguably it should at least warn).

I think that downgrading this to `warning_errno()` is appropriate. I'll make that change locally and send a new version.

I think a good separate topic is teaching `remove_redundant_pack()` to emit warnings for non-ENOENT errors, too. But I'll leave that for another day :-).

Show 33 quoted lines
> > @@ -1059,10 +1088,15 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
> >  						refs_snapshot ? get_tempfile_path(refs_snapshot) : NULL,
> >  						show_progress, write_bitmaps > 0);
> >
> > +		if (ret) {
> > +			string_list_clear(&include, 0);
> > +			return ret;
> > +		}
> > +
> > +		if (write_bitmaps)
> > +			remove_redundant_bitmaps(&include, packdir);
> > +
> >  		string_list_clear(&include, 0);
> > -
> > -		if (ret)
> > -			return ret;
> >  	}
>
> You could avoid having to repeat the string-list cleanup here by
> structuring it like:
>
>   if (!ret && write_bitmaps)
> 	remove_redundant_bitmaps(&include, packdir);
>
>   /* as before, clear string list and possibly return ret */
>
> Since it's only one line, it's not that big a deal, but it simplifies
> the flow.
>
> It's correct either way, of course. One thing I did have to do while
> reviewing this was look at this hunk in place. The context omits that
> this is in the "if (write_midx)" conditional, which is of course very
> important. ;)
Great suggestion, thanks. I'll apply it locally and send a reroll now.

Thanks, Taylor

Previous: Taylor BlauNext: Taylor Blau
Message 8 of 10 in “builtin/repack.c: remove redundant pack-based bitmaps”
  1. builtin/repack.c: remove redundant pack-based bitmapsTaylor Blau, Oct 12, 2022
  2. Jeff KingOct 17, 2022
  3. Ævar Arnfjörð BjarmasonOct 17, 2022
  4. Jeff KingOct 17, 2022
  5. Junio C HamanoOct 17, 2022
  6. Jeff KingOct 17, 2022
  7. Taylor BlauOct 18, 2022
  8. Taylor BlauOct 18, 2022
  9. builtin/repack.c: remove redundant pack-based bitmapsTaylor Blau, Oct 18, 2022
  10. Jeff KingOct 18, 2022

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.