mirror of
https://github.com/git/git.git
synced 2026-08-09 01:21:47 +00:00
tempfile: add repo_create_tempfile{,_mode}()
Add variants of create_tempfile_mode() that handle arbitrary repositories. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
e9019fcafe
commit
8aad1dfc00
11
tempfile.h
11
tempfile.h
@@ -4,6 +4,8 @@
|
||||
#include "list.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
struct repository;
|
||||
|
||||
/*
|
||||
* Handle temporary files.
|
||||
*
|
||||
@@ -94,11 +96,20 @@ struct tempfile {
|
||||
*/
|
||||
struct tempfile *create_tempfile_mode(const char *path, int mode);
|
||||
|
||||
struct tempfile *repo_create_tempfile_mode(struct repository *r,
|
||||
const char *path, int mode);
|
||||
|
||||
static inline struct tempfile *create_tempfile(const char *path)
|
||||
{
|
||||
return create_tempfile_mode(path, 0666);
|
||||
}
|
||||
|
||||
static inline struct tempfile *repo_create_tempfile(struct repository *r,
|
||||
const char *path)
|
||||
{
|
||||
return repo_create_tempfile_mode(r, path, 0666);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register an existing file as a tempfile, meaning that it will be
|
||||
* deleted when the program exits. The tempfile is considered closed,
|
||||
|
||||
Reference in New Issue
Block a user