summaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-05-05 21:54:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-05 21:54:28 (GMT)
commit1d7e9c4c4e60375146ad70ed5c555574a653e92a (patch)
treea7feeb931a91fcb166a508f495f125208ee90155 /commit-graph.c
parentb75dc16ae3aa325941d64a3d0cfc1690a164786a (diff)
parent45a4365cb610adce1c37c099da7d18619725ce4f (diff)
downloadgit-1d7e9c4c4e60375146ad70ed5c555574a653e92a.zip
git-1d7e9c4c4e60375146ad70ed5c555574a653e92a.tar.gz
git-1d7e9c4c4e60375146ad70ed5c555574a653e92a.tar.bz2
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 6dc777e..aa3adb9 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);
}