Re: [PATCH v2] read-cache: write all indexes with the same permissions
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Nov 16, 2018, 18:02 UTC
- Message-ID
- <CACsJy8Cdk8YQWJM1HAFYWB6qJpepNQoj86yrTqF9Rg3oN0TeUA@mail.gmail.com>
- In-Reply-To
- <20181116173105.21784-1-chriscool@tuxfamily.org>
On Fri, Nov 16, 2018 at 6:31 PM Christian Couder <christian.couder@gmail.com> wrote:
Show 10 quoted lines
> diff --git a/read-cache.c b/read-cache.c
> index 8c924506dd..ea80600bff 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -3165,7 +3165,8 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
> struct tempfile *temp;
> int saved_errno;
>
> - temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
> + /* Same permissions as the main .git/index file */If the permission is already correct from the beginning (of this temp file), should df801f3f9f be reverted since we don't need to adjust permission anymore?
Or does $GIT_DIR/index go through the same adjust_shared_perm() anyway in the end, which means df801f3f9f must stay? If so, perhaps clarify that in the commit message.
> + temp = mks_tempfile_sm(git_path("sharedindex_XXXXXX"), 0, 0666);
> if (!temp) {
> oidclr(&si->base_oid);
> ret = do_write_locked_index(istate, lock, flags);-- Duy