summaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-05-05 14:54:28 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-05-05 14:54:28 -0700
commit1d7e9c4c4e60375146ad70ed5c555574a653e92a (patch)
treea7feeb931a91fcb166a508f495f125208ee90155 /commit-graph.c
parentMerge branch 'dl/push-recurse-submodules-fix' (diff)
parentcommit-graph.c: make 'commit-graph-chain's read-only (diff)
downloadtgif-1d7e9c4c4e60375146ad70ed5c555574a653e92a.tar.xz
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 'commit-graph.c')
-rw-r--r--commit-graph.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 6dc777e2f3..aa3adb912f 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1576,7 +1576,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) {
@@ -1584,9 +1585,16 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
return -1;
}
+ if (adjust_shared_perm(ctx->graph_name)) {
+ error(_("unable to adjust shared permissions for '%s'"),
+ ctx->graph_name);
+ return -1;
+ }
+
f = hashfd(fd, ctx->graph_name);
} else {
- hold_lock_file_for_update(&lk, ctx->graph_name, LOCK_DIE_ON_ERROR);
+ hold_lock_file_for_update_mode(&lk, ctx->graph_name,
+ LOCK_DIE_ON_ERROR, 0444);
fd = lk.tempfile->fd;
f = hashfd(lk.tempfile->fd, lk.tempfile->filename.buf);
}