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

Re: [PATCH] prune-packed: remove USE_THE_REPOSITORY_VARIABLE

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 19, 2026, 07:09 UTC
Message-ID
<atXCFxxe3Lg7fV2W@pks.im>
In-Reply-To
<pull.2266.git.1792341073005.gitgitgadget@gmail.com>
On Sun, Oct 18, 2026 at 04:31:12PM +0000, Shashank S via GitGitGadget wrote:
> From: Shashank <shashu8660@gmail.com>
> 
> Right now, the prune_packed_objects() function uses the global
Nit: we typically refrain from saying "now", as it's implicitly clear
that you're describing the status quo in your commit message unless you
explicitly refer to an older commit.
Show 15 quoted lines
> the_repository variable. To help with the libification effort,
> change this function so it takes a 'struct repository' pointer
> as an argument instead.
> 
> The function for_each_loose_file_in_source() uses a callback
> that only takes a single 'void *data' pointer. This means we
> cannot pass both the repository pointer and the 'opts' integer
> at the same time. To fix this, create a new 'struct prune_data'
> to hold both of them together, and update the prune_subdir() and
> prune_object() callbacks to read from this new struct.
> 
> Update the builtins that call this function (builtin/prune-packed.c,
> builtin/prune.c, and builtin/repack.c) to pass their local `repo`
> variables. Because we are now actually using the 'repo'  parameter
> in these files, we can safely remove the UNUSED macro from them.

The question isn't really whether we can safely remove the UNUSED macro. The question is rather whether we can assume that `repo` always points to a proper repository. And for that you need to research whether these commands can be invoked outside of a repository, because if so the repo may be `NULL`.

> finally, drop the USE_THE_REPOSITORY_VARIABLE macro from
s/finally/Finally
> prune-packed.c.
> 
> Signed-off-by: Shashank <shashu8660@gmail.com>

We typically ask contributors to spell out their full name, see Documentation/SubmittingPatches [[real-name]].

The changes all look sensible to me, thanks!
Patrick
Previous: Shashank S via GitGitGadgetNext: Shashank S
Message 2 of 14 in “prune-packed: remove USE_THE_REPOSITORY_VARIABLE”
  1. prune-packed: remove USE_THE_REPOSITORY_VARIABLEShashank S via GitGitGadget, Oct 18, 2026
  2. Patrick SteinhardtOct 19, 2026
  3. Shashank SOct 19, 2026
  4. Junio C HamanoOct 19, 2026
  5. Shashank SOct 20, 2026
  6. [Outreachy Patch] prune-packed: remove USE_THE_REPOSITORY_VARIABLEShashank S via GitGitGadget, Oct 19, 2026
  7. Patrick SteinhardtOct 23, 2026
  8. Shashank SOct 24, 2026
  9. prune-packed: remove USE_THE_REPOSITORY_VARIABLEShashank S via GitGitGadget, Oct 24, 2026
  10. Patrick SteinhardtOct 26, 2026
  11. Shashank SOct 27, 2026
  12. prune-packed: remove USE_THE_REPOSITORY_VARIABLEShashank S via GitGitGadget, Oct 27, 2026
  13. Patrick SteinhardtOct 28, 2026
  14. Junio C HamanoOct 28, 2026

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.