Re: [PATCH 1/5] tempfile: add repo_create_tempfile{,_mode}()
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 15, 2026, 09:52 UTC
- Message-ID
- <aldYTuMvN-8EMvYK@pks.im>
- In-Reply-To
- <20260714175956.54601-2-l.s.r@web.de>
On Tue, Jul 14, 2026 at 07:59:52PM +0200, René Scharfe wrote:
> Add variants of create_tempfile_mode() that handle arbitrary > repositories.
One thing I was wondering is whether it really makes sense to pass in a full repository. All we require it for is `adjust_shared_perm()`, and it feels quite extreme to require a full-blown repository.
An alternative would be to let callers pass in the setting by themselves, but that would likely lead to lots of duplicated code. So maybe this is a good first step, and we could eventually create another API where users can pass in the configuration instead of a repository if we ever gain callers that don't have a repository available.
Show 11 quoted lines
> diff --git a/tempfile.c b/tempfile.c
> index f0fdf58279..3132eb4371 100644
> --- a/tempfile.c
> +++ b/tempfile.c
> @@ -135,6 +135,12 @@ static void deactivate_tempfile(struct tempfile *tempfile)
>
> /* Make sure errno contains a meaningful value on error */
> struct tempfile *create_tempfile_mode(const char *path, int mode)
> +{
> + return repo_create_tempfile_mode(the_repository, path, mode);
> +}Nit: We could've easily created this as an inline function in "tempfile.h". But I expect that we'll get mostly rid of this function in subssubsequent patches, so it probably doesn't matter too much.
Patrick