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

Re: [PATCH 1/5] tempfile: add repo_create_tempfile{,_mode}()

From
René Scharfe <l.s.r@web.de>
Date
Jul 15, 2026, 11:25 UTC
Message-ID
<a84437e9-6a7d-41b9-b638-30c81eecd672@web.de>
In-Reply-To
<aldYTuMvN-8EMvYK@pks.im>
On 7/15/26 11:52 AM, Patrick Steinhardt wrote:
Show 13 quoted lines
> 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.

Had the same thought. I think it's because create_tempfile() sounds quite generic, but is actually for creating temporary files within a repository, not just anywhere or just for the duration of the creating process, so shared access matters (if enabled).

I didn't find a case where a caller would not have at least the_repository to pass in, so while a repo-less adjust_shared_perm() or create_tempfile() might seem cleaner, we probably won't need it in practice. We'll find out..

René
Previous: Patrick SteinhardtNext: René Scharfe
Message 4 of 15 in “tempfile: stop using the_repository”
  1. 0/5 tempfile: stop using the_repositoryRené Scharfe, Jul 14, 2026
  2. 1/5 tempfile: add repo_create_tempfile{,_mode}()René Scharfe, Jul 14, 2026
  3. Patrick SteinhardtJul 15, 2026
  4. René ScharfeJul 15, 2026
  5. 2/5 refs/packed: use repo_create_tempfile()René Scharfe, Jul 14, 2026
  6. 3/5 lockfile: add repo_hold_lock_file_for_update{,_timeout}{,_mode}()René Scharfe, Jul 14, 2026
  7. 4/5 tempfile: stop using the_repositoryRené Scharfe, Jul 14, 2026
  8. Patrick SteinhardtJul 15, 2026
  9. 5/5 use repo_hold_lock_file_for_update{,_mode,_timeout}() with custom reposRené Scharfe, Jul 14, 2026
  10. Patrick SteinhardtJul 15, 2026
  11. René ScharfeJul 18, 2026
  12. Junio C HamanoJul 19, 2026
  13. Patrick SteinhardtJul 21, 2026
  14. Junio C HamanoJul 14, 2026
  15. Patrick SteinhardtJul 15, 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.