diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-01-26 11:09:10 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-01-26 08:21:44 -0800 |
| commit | b3a79dd4e97a76317b528437e7413452b285ee88 (patch) | |
| tree | 2dc66af145b7a0243bddec7c4eaf4b9457bd876c /reftable/stack.c | |
| parent | e02ecfcc534e2021aae29077a958dd11c3897e4c (diff) | |
| download | git-b3a79dd4e97a76317b528437e7413452b285ee88.tar.xz | |
reftable/stack: adjust permissions of compacted tables
When creating a new compacted table from a range of preexisting ones we
don't set the default permissions on the resulting table when specified
by the user. This has the effect that the "core.sharedRepository" config
will not be honored correctly.
Fix this bug and add a test to catch this issue. Note that we only test
on non-Windows platforms because Windows does not use POSIX permissions
natively.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/stack.c')
| -rw-r--r-- | reftable/stack.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/reftable/stack.c b/reftable/stack.c index 7ffeb3ee10..38e784a8ab 100644 --- a/reftable/stack.c +++ b/reftable/stack.c @@ -731,6 +731,12 @@ static int stack_compact_locked(struct reftable_stack *st, int first, int last, strbuf_addstr(temp_tab, ".temp.XXXXXX"); tab_fd = mkstemp(temp_tab->buf); + if (st->config.default_permissions && + chmod(temp_tab->buf, st->config.default_permissions) < 0) { + err = REFTABLE_IO_ERROR; + goto done; + } + wr = reftable_new_writer(reftable_fd_write, &tab_fd, &st->config); err = stack_write_compact(st, wr, first, last, config); |
