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

[PATCH v2 0/2] [Outreachy PATCH] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules

From
SGSrujith A Poojary via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 10, 2026, 06:03 UTC
Message-ID
<pull.2305.v2.git.1794290598.gitgitgadget@gmail.com>
In-Reply-To
<pull.2305.git.1794251100.gitgitgadget@gmail.com>

Refactored archive-tar.c, archive-zip.c, archive.c, and supporting files to use explicit struct repository *repo pointers instead of global repository variables.

Srujith A Poojary (2):
  submodule: use the submodule repository to abbreviate commits
  archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules
 archive-tar.c                    |  5 ++---
 builtin/archive.c                |  1 +
 submodule.c                      |  5 +++--
 t/t4041-diff-submodule-option.sh | 23 +++++++++++++++++++++++
 4 files changed, 29 insertions(+), 5 deletions(-)
base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2305%2Fpoojarysrujith%2Farchive-libification-refactor-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2305/poojarysrujith/archive-libification-refactor-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2305
Range-diff vs v1:
 1:  01c3cc2573 = 1:  01c3cc2573 submodule: use the submodule repository to abbreviate commits
 2:  eeed27222b ! 2:  3d8d9a9261 archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules
     @@ Commit message
      
       ## archive-tar.c ##
      @@
     -  * Copyright (c) 2005, 2006 Rene Scharfe
        */
       
     --#define USE_THE_REPOSITORY_VARIABLE
     + #define USE_THE_REPOSITORY_VARIABLE
      -
       #include "git-compat-util.h"
       #include "config.h"
     @@ archive-tar.c: static void write_global_extended_header(struct archiver_args *ar
       		strbuf_append_ext_header_uint(&ext_header, "mtime",
       					      args->time);
      @@ archive-tar.c: static struct archiver tar_archiver = {
     - 	.flags = ARCHIVER_REMOTE,
     - };
     - 
     --void init_tar_archiver(void)
     -+void init_tar_archiver(struct repository *repo)
     + void init_tar_archiver(void)
       {
       	int i;
     ++	repo_config(the_repository, git_tar_config, NULL);
       	register_archiver(&tar_archiver);
     -@@ archive-tar.c: void init_tar_archiver(void)
     + 
     + 	tar_filter_config("tar.tgz.command", internal_gzip_command, NULL);
       	tar_filter_config("tar.tgz.remote", "true", NULL);
       	tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
       	tar_filter_config("tar.tar.gz.remote", "true", NULL);
      -	repo_config(the_repository, git_tar_config, NULL);
     -+	repo_config(repo, git_tar_config, NULL);
       	for (i = 0; i < nr_tar_filters; i++) {
       		/* omit any filters that never had a command configured */
       		if (tar_filters[i]->filter_command)
      
     - ## archive-zip.c ##
     -@@ archive-zip.c: static struct archiver zip_archiver = {
     - 	.flags = ARCHIVER_WANT_COMPRESSION_LEVELS|ARCHIVER_REMOTE,
     - };
     - 
     --void init_zip_archiver(void)
     -+void init_zip_archiver(struct repository *repo)
     - {
     -+	(void)repo;
     - 	register_archiver(&zip_archiver);
     - }
     -
     - ## archive.c ##
     -@@ archive.c: void register_archiver(struct archiver *ar)
     - 	archivers[nr_archivers++] = ar;
     - }
     - 
     --void init_archivers(void)
     -+void init_archivers(struct repository *repo)
     - {
     --	init_tar_archiver();
     --	init_zip_archiver();
     -+	init_tar_archiver(repo);
     -+	init_zip_archiver(repo);
     - }
     - 
     - static void format_subst(const struct commit *commit,
     -
     - ## archive.h ##
     -@@ archive.h: 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,
     -
       ## builtin/archive.c ##
      @@
        * Copyright (c) 2006 Franck Bui-Huu
     @@ builtin/archive.c
       #include "builtin.h"
       #include "archive.h"
       #include "gettext.h"
     -@@ builtin/archive.c: int cmd_archive(int argc,
     - 	argc = parse_options(argc, argv, prefix, local_opts, NULL,
     - 			     PARSE_OPT_KEEP_ALL);
     - 
     --	init_archivers();
     -+	init_archivers(the_repository);
     - 
     - 	if (output)
     - 		create_output_file(output);
     -
     - ## builtin/upload-archive.c ##
     -@@ builtin/upload-archive.c: 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);
     - 
     - 	/* put received options in sent_argv[] */
     - 	strvec_push(&sent_argv, "git-upload-archive");
     -
     - ## diagnose.c ##
     -@@ diagnose.c: int create_diagnostics_archive(struct repository *r,
     - 		goto diagnose_cleanup;
     - 	}
     - 
     --	init_zip_archiver();
     -+	init_zip_archiver(r);
     - 	strvec_pushl(&archiver_args, "git-diagnose", "--format=zip", NULL);
     - 
     - 	strbuf_reset(&buf);
-- 
gitgitgadget
Previous: Srujith PoojaryNext: Srujith A Poojary via GitGitGadget
Message 6 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.