# update index mtime etc metadata

2 messages from 2015-12-14 to 2015-12-15. Participants: Joey Hess, Duy Nguyen.
Thread: https://gitlist.dev/t/40996

## Joey Hess, 2015-12-14 20:44

Subject: update index mtime etc metadata
Message-ID: <20151214204429.GA31013@kitenet.net>
URL: https://gitlist.dev/e/20151214204429.GA31013%40kitenet.net

```
Is there any available plumbing that can change the mtime etc metadata
that is recorded in the index for a file, to user-provided values? Or,
to force the current file stat metadata to be updated in the index?

I know, git update-index --refresh, but I have a case where that's too
expensive. I'm using smudge filters; I know that the cleaned version of
the file will be unchanged from what's in the index now and only the
stat metadata will change, and so I want to avoid
git update-index --refresh running the clean filter, which can
be quite expensive for a large file.

At the moment I don't see a way to do it other than using eg libgit2 to
update the appropriate fields in the index structure.

-- 
see shy jo

```

## Duy Nguyen, 2015-12-15 11:17

Subject: Re: update index mtime etc metadata
Message-ID: <CACsJy8DUxBxQJxe0RzJAs7oeu0FbVhEF3OZFpHNp==1DD_Ht4w@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8DUxBxQJxe0RzJAs7oeu0FbVhEF3OZFpHNp%3D%3D1DD_Ht4w%40mail.gmail.com
In-Reply-To: <20151214204429.GA31013@kitenet.net>

```
On Tue, Dec 15, 2015 at 3:44 AM, Joey Hess <id@joeyh.name> wrote:
> Is there any available plumbing that can change the mtime etc metadata
> that is recorded in the index for a file, to user-provided values? Or,
> to force the current file stat metadata to be updated in the index?

I don't think there is a way. We probably should improve ls-files and
update-index to examine and update basically everything in the index..
But so far, nothing yet.

> I know, git update-index --refresh, but I have a case where that's too
> expensive. I'm using smudge filters; I know that the cleaned version of
> the file will be unchanged from what's in the index now and only the
> stat metadata will change, and so I want to avoid
> git update-index --refresh running the clean filter, which can
> be quite expensive for a large file.
>
> At the moment I don't see a way to do it other than using eg libgit2 to
> update the appropriate fields in the index structure.

Yeah. I see libgit2 has a haskell binding, probably best for you.
-- 
Duy

```
