]> git.ipfire.org Git - thirdparty/git.git/commit
interpret-trailers: refactor create_in_place_tempfile()
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 6 Mar 2026 14:53:28 +0000 (14:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Mar 2026 21:02:19 +0000 (13:02 -0800)
commit876b2ebee2cd520f6ce78ac9bcf4c5486e509a1d
tree5ad0124de8470ff27b3b3836e461d89551988d78
parent8efabc9e64f9c93a764b0d38981bf99d75f502bd
interpret-trailers: refactor create_in_place_tempfile()

Refactor create_in_place_tempfile() in preparation for moving it
to tralier.c. Change the return type to return a `struct tempfile*`
instead of a `FILE*` so that we can remove the file scope tempfile
variable. Since 076aa2cbda5 (tempfile: auto-allocate tempfiles on
heap, 2017-09-05) it has not been necessary to make tempfile varibales
static so this is safe. Also use error() and return NULL in place of
die() so the caller can exit gracefully and use find_last_dir_sep()
rather than strchr() to find the parent directory.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/interpret-trailers.c