summaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2020-04-29 17:36:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-29 19:35:30 (GMT)
commit45a4365cb610adce1c37c099da7d18619725ce4f (patch)
tree9e85404e6e5dfe3c663c856a3fb06453e6b2fa45 /commit-graph.c
parentf4d62847a431af965b8a6895b92f4372042457b0 (diff)
downloadgit-45a4365cb610adce1c37c099da7d18619725ce4f.zip
git-45a4365cb610adce1c37c099da7d18619725ce4f.tar.gz
git-45a4365cb610adce1c37c099da7d18619725ce4f.tar.bz2
commit-graph.c: make 'commit-graph-chain's read-only
In a previous commit, we made incremental graph layers read-only by using 'git_mkstemp_mode' with permissions '0444'. There is no reason that 'commit-graph-chain's should be modifiable by the user, since they are generated at a temporary location and then atomically renamed into place. To ensure that these files are read-only, too, use 'hold_lock_file_for_update_mode' with the same read-only permission bits, and let the umask and 'adjust_shared_perm' take care of the rest. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c
index d05a559..b2dfd77 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1378,7 +1378,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
if (ctx->split) {
char *lock_name = get_chain_filename(ctx->odb);
- hold_lock_file_for_update(&lk, lock_name, LOCK_DIE_ON_ERROR);
+ hold_lock_file_for_update_mode(&lk, lock_name,
+ LOCK_DIE_ON_ERROR, 0444);
fd = git_mkstemp_mode(ctx->graph_name, 0444);
if (fd < 0) {