Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Srujith A Poojary <poojarysrujith@gmail.com>
Subject: Re: [PATCH 2/2] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules
Date: Mon, 09 Nov 2026 12:45:34 -0800	[thread overview]
Message-ID: <xmqqcxsdybrl.fsf@gitster.g> (raw)
In-Reply-To: <eeed27222be51590775352e5a3b7677e21d36a93.1794251100.git.gitgitgadget@gmail.com> (Srujith A. Poojary via GitGitGadget's message of "Mon, 09 Nov 2026 19:05:00 +0000")

"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.

  reply	other threads:[~2026-11-09 20:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 19:04 [PATCH 0/2] [Outreachy PATCH] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules Srujith A Poojary via GitGitGadget
2026-11-09 19:04 ` [PATCH 1/2] submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-11-09 19:05 ` [PATCH 2/2] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules Srujith A Poojary via GitGitGadget
2026-11-09 20:45   ` Junio C Hamano [this message]
2026-11-10  8:13     ` Srujith Poojary
2026-11-10  6:03 ` [PATCH v2 0/2] [Outreachy PATCH] " Srujith A Poojary via GitGitGadget
2026-11-10  6:03   ` [PATCH v2 1/2] submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-11-10  6:03   ` [PATCH v2 2/2] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules Srujith A Poojary via GitGitGadget
2026-11-10 16:07     ` Junio C Hamano
2026-11-10 18:33       ` Srujith Poojary
2026-11-10 18:39 ` [PATCH v3 0/2] [Outreachy PATCH] " Srujith A Poojary via GitGitGadget
2026-11-10 18:39   ` [PATCH v3 1/2] submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-11-10 20:26     ` Junio C Hamano
2026-11-11  4:19       ` Srujith Poojary
2026-11-10 18:39   ` [PATCH v3 2/2] archive: remove USE_THE_REPOSITORY_VARIABLE from archival modules Srujith A Poojary via GitGitGadget
2026-11-10 20:40     ` Junio C Hamano
2026-11-11  4:17       ` Srujith Poojary
2026-11-11  8:34       ` Srujith Poojary
2026-11-10 19:17   ` [PATCH v3 0/2] [Outreachy PATCH] " Junio C Hamano
2026-11-11  8:25 ` [PATCH v4] " Srujith A Poojary via GitGitGadget
2026-11-11 11:08   ` Karthik Nayak
2026-11-11 12:24     ` Srujith Poojary
2026-11-11 12:45 ` [PATCH v5] archive-tar: add comments explaining configuration precedence Srujith A Poojary via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqcxsdybrl.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=poojarysrujith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox