aboutsummaryrefslogtreecommitdiffstats
path: root/tempfile.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-05-05 14:54:28 -0700
committerJunio C Hamano <gitster@pobox.com>2020-05-05 14:54:28 -0700
commit1d7e9c4c4e60375146ad70ed5c555574a653e92a (patch)
treea7feeb931a91fcb166a508f495f125208ee90155 /tempfile.h
parentb75dc16ae3aa325941d64a3d0cfc1690a164786a (diff)
parent45a4365cb610adce1c37c099da7d18619725ce4f (diff)
downloadgit-1d7e9c4c4e60375146ad70ed5c555574a653e92a.tar.gz
Merge branch 'tb/commit-graph-perm-bits'
Some of the files commit-graph subsystem keeps on disk did not correctly honor the core.sharedRepository settings and some were left read-write. * tb/commit-graph-perm-bits: commit-graph.c: make 'commit-graph-chain's read-only commit-graph.c: ensure graph layers respect core.sharedRepository commit-graph.c: write non-split graphs as read-only lockfile.c: introduce 'hold_lock_file_for_update_mode' tempfile.c: introduce 'create_tempfile_mode'
Diffstat (limited to 'tempfile.h')
-rw-r--r--tempfile.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/tempfile.h b/tempfile.h
index cddda0a33c..4de3bc77d2 100644
--- a/tempfile.h
+++ b/tempfile.h
@@ -88,8 +88,16 @@ struct tempfile {
* Attempt to create a temporary file at the specified `path`. Return
* a tempfile (whose "fd" member can be used for writing to it), or
* NULL on error. It is an error if a file already exists at that path.
+ * Note that `mode` will be further modified by the umask, and possibly
+ * `core.sharedRepository`, so it is not guaranteed to have the given
+ * mode.
*/
-struct tempfile *create_tempfile(const char *path);
+struct tempfile *create_tempfile_mode(const char *path, int mode);
+
+static inline struct tempfile *create_tempfile(const char *path)
+{
+ return create_tempfile_mode(path, 0666);
+}
/*
* Register an existing file as a tempfile, meaning that it will be