Skip to contentSkip to conversation

update index mtime etc metadata

DISCUSSION Joey Hess 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Joey Hess

author
#0 lore raw

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.

Signature · 1 line
see shy jo
#1 lore raw
Quoted 3 lines · Joey Hess

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.

Quoted 9 lines

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.

Signature · 1 line
Duy