From: shejialuo <shejialuo@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 06/14] server-info: stop using `the_repository`
Date: Tue, 17 Dec 2024 20:31:04 +0800 [thread overview]
Message-ID: <Z2FvCKYdRLZzHJVC@ArchLinux> (raw)
In-Reply-To: <20241217-pks-use-the-repository-conversion-v1-6-0dba48bcc239@pks.im>
On Tue, Dec 17, 2024 at 07:43:53AM +0100, Patrick Steinhardt wrote:
> Stop using `the_repository` in the "server-info" subsystem by passing in
> a repository when updating server info and storing the repository in the
> `update_info_ctx` structure to make it accessible to other functions.
>
> Adjust callers accordingly by using `the_repository`. While there may be
> some callers that have a repository available in their context, this
> trivial conversion allows for easier verification and bubbles up the use
> of `the_repository` by one level.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> builtin/receive-pack.c | 2 +-
> builtin/repack.c | 2 +-
> builtin/update-server-info.c | 2 +-
> server-info.c | 40 ++++++++++++++++++++++------------------
> server-info.h | 4 +++-
> 5 files changed, 28 insertions(+), 22 deletions(-)
>
> -int update_server_info(int force)
> +int update_server_info(struct repository *r, int force)
> {
> /* We would add more dumb-server support files later,
> * including index of available pack files and their
> * intended audiences.
> */
> int errs = 0;
> + char *path;
>
> - errs = errs | update_info_refs(force);
> - errs = errs | update_info_packs(force);
> + errs = errs | update_info_refs(r, force);
> + errs = errs | update_info_packs(r, force);
>
> /* remove leftover rev-cache file if there is any */
> - unlink_or_warn(git_path("info/rev-cache"));
> + path = repo_git_path(r, "info/rev-cache");
> + unlink_or_warn(path);
> + free(path);
>
The original "git_path" will be returned from the static string buffers,
so there is no need to free. But "repo_git_path" will return a allocated
string, the caller need to explicit free this. Make sense.
> return errs;
> }
next prev parent reply other threads:[~2024-12-17 12:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 6:43 [PATCH 00/14] Stop using `the_repository` in some trivial cases Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 01/14] progress: stop using `the_repository` Patrick Steinhardt
2024-12-31 6:42 ` Karthik Nayak
2025-01-06 20:57 ` Toon Claes
2025-01-07 7:19 ` Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 02/14] pager: " Patrick Steinhardt
2024-12-17 12:17 ` shejialuo
2024-12-31 6:55 ` Karthik Nayak
2024-12-17 6:43 ` [PATCH 03/14] trace: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 04/14] serve: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 05/14] send-pack: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 06/14] server-info: " Patrick Steinhardt
2024-12-17 12:31 ` shejialuo [this message]
2024-12-17 6:43 ` [PATCH 07/14] diagnose: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 08/14] mailinfo: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 09/14] credential: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 10/14] resolve-undo: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 11/14] tmp-objdir: " Patrick Steinhardt
2024-12-17 6:43 ` [PATCH 12/14] add-interactive: " Patrick Steinhardt
2024-12-17 6:44 ` [PATCH 13/14] graph: " Patrick Steinhardt
2024-12-17 6:44 ` [PATCH 14/14] match-trees: " Patrick Steinhardt
2024-12-17 12:45 ` [PATCH 00/14] Stop using `the_repository` in some trivial cases shejialuo
2024-12-27 14:26 ` Patrick Steinhardt
2025-01-07 11:41 ` Karthik Nayak
2025-01-07 21:12 ` Toon Claes
2025-01-07 21:15 ` Junio C Hamano
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=Z2FvCKYdRLZzHJVC@ArchLinux \
--to=shejialuo@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.