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

Re: [PATCH 2/2] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules

From
SPSrujith Poojary <poojarysrujith@gmail.com>
Date
Nov 10, 2026, 08:13 UTC
Message-ID
<CABh_KWh0qUoAoUKJoeM1aayNBrYFw33=KXiBvYRFTcRB0hW9WQ@mail.gmail.com>
In-Reply-To
<xmqqcxsdybrl.fsf@gitster.g>
On Tue, Nov 10, 2026 at 2:15 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 67 quoted lines
>
> "Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > diff --git a/archive-tar.c b/archive-tar.c
> > diff --git a/archive-zip.c b/archive-zip.c
> > diff --git a/archive.c b/archive.c
> > diff --git a/archive.h b/archive.h
> > index bbe65ba0f9..8ec59b22e9 100644
> > --- a/archive.h
> > +++ b/archive.h
> > @@ -48,9 +48,9 @@ struct archiver {
> >  };
> >  void register_archiver(struct archiver *);
> >
> > -void init_tar_archiver(void);
> > -void init_zip_archiver(void);
> > -void init_archivers(void);
> > +void init_tar_archiver(struct repository *repo);
> > +void init_zip_archiver(struct repository *repo);
> > +void init_archivers(struct repository *repo);
> >
> >  typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
> >                                       const struct object_id *oid,
>
> All of the above is straight-forward.  Pass a single "repo"
> parameter throughout the callchain and you are done.
>
> > diff --git a/builtin/archive.c b/builtin/archive.c
> > index 3c1288a123..e35b9637ce 100644
> > --- a/builtin/archive.c
> > +++ b/builtin/archive.c
> > @@ -2,6 +2,7 @@
> >   * Copyright (c) 2006 Franck Bui-Huu
> >   * Copyright (c) 2006 Rene Scharfe
> >   */
> > +#define USE_THE_REPOSITORY_VARIABLE
> >  #include "builtin.h"
> >  #include "archive.h"
> >  #include "gettext.h"
> > @@ -97,7 +98,7 @@ int cmd_archive(int argc,
> >       argc = parse_options(argc, argv, prefix, local_opts, NULL,
> >                            PARSE_OPT_KEEP_ALL);
> >
> > -     init_archivers();
> > +     init_archivers(the_repository);
>
> This looks curious.
>
> When would the parameter "repo" an invalid repository (due to
> RUN_SETUP_GENTLY defined for "archive" entry in git.c:commands[]),
> yet using the_repository is a reasonable choice?
>
> > diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
> > index 718e74b3ac..3cfc7ffaf3 100644
> > --- a/builtin/upload-archive.c
> > +++ b/builtin/upload-archive.c
> > @@ -34,7 +34,7 @@ int cmd_upload_archive_writer(int argc,
> >       if (!enter_repo(the_repository, argv[1], 0))
> >               die("'%s' does not appear to be a git repository", argv[1]);
> >
> > -     init_archivers();
> > +     init_archivers(the_repository);
>
> It is correct to use the_repository here, the same repository we
> used for the enter_repo() call that immediately comes before this
> step.
Hi Junio,
Thanks for taking a look at the patch series and for the feedback.
I've updated the patch series to address your comments:
* Cleaned up the function signatures for `init_archivers()`,
`init_tar_archiver()`, and `init_zip_archiver()` to use `void`
parameters and removed the unused `struct repository *repo`
references.
* Updated caller sites across `builtin/archive.c`,
`builtin/upload-archive.c`, and `diagnose.c` to use `the_repository`
where appropriate.
* Ensured proper header inclusion order (`git-compat-util.h` first) to
resolve compilation issues cleanly.

The revised branch is pushed and ready for your review. Let me know if everything looks good or if any further changes are needed.

Best regards, Srujith

Previous: Junio C HamanoNext: Srujith A Poojary via GitGitGadget
Message 5 of 23 in “archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules”
  1. 0/2 [Outreachy PATCH] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 9, 2026
  2. 1/2 submodule: use the submodule repository to abbreviate commitsSrujith A Poojary via GitGitGadget, Nov 9, 2026
  3. 2/2 archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 9, 2026
  4. Junio C HamanoNov 9, 2026
  5. Srujith PoojaryNov 10, 2026
  6. 0/2 [Outreachy PATCH] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 10, 2026
  7. 1/2 submodule: use the submodule repository to abbreviate commitsSrujith A Poojary via GitGitGadget, Nov 10, 2026
  8. 2/2 archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 10, 2026
  9. Junio C HamanoNov 10, 2026
  10. Srujith PoojaryNov 10, 2026
  11. 0/2 [Outreachy PATCH] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 10, 2026
  12. 1/2 submodule: use the submodule repository to abbreviate commitsSrujith A Poojary via GitGitGadget, Nov 10, 2026
  13. Junio C HamanoNov 10, 2026
  14. Srujith PoojaryNov 11, 2026
  15. 2/2 archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 10, 2026
  16. Junio C HamanoNov 10, 2026
  17. Srujith PoojaryNov 11, 2026
  18. Srujith PoojaryNov 11, 2026
  19. Junio C HamanoNov 10, 2026
  20. archive: remove USE_THE_REPOSITORY_VARIABLE from archival modulesSrujith A Poojary via GitGitGadget, Nov 11, 2026
  21. Karthik NayakNov 11, 2026
  22. Srujith PoojaryNov 11, 2026
  23. archive-tar: add comments explaining configuration precedenceSrujith A Poojary via GitGitGadget, Nov 11, 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.