Skip to contentSkip to conversation

Forcing re-reading files with unchanged stats

DISCUSSION Maaartin 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Maaartin

author
#0 lore raw

There are files in my working tree which changes, but their size and mtime remains the same (I know it's strange, but it's useful). Can I make git to re- read them all, so it recognizes the change? Ideally, using a configuration variable. The repo is fairly small, so speed is no issue here.

#1 lore raw
Quoted 2 lines · Maaartin

There are files in my working tree which changes, but their size and mtime remains the same (I know it's strange, but it's useful). Can I make git to re-

When can this be useful?

Quoted 2 lines

read them all, so it recognizes the change? Ideally, using a configuration variable. The repo is fairly small, so speed is no issue here.

Try git update-index --refresh. I'm not aware of any config option, but you might want to look through man git-config.

tom

#2 lore raw
Quoted 11 lines · Tomas Carnecky
Quoted 2 lines · Maaartin

There are files in my working tree which changes, but their size and mtime remains the same (I know it's strange, but it's useful). Can I make git to re-

When can this be useful?

Quoted 2 lines

read them all, so it recognizes the change? Ideally, using a configuration variable. The repo is fairly small, so speed is no issue here.

Try git update-index --refresh. I'm not aware of any config option, but you might want to look through man git-config.

That won't work, as it respects the stat information. So does --really-refresh. AFAIK, there isn't a way to tell update-index to ignore start information, short of blowing away the index entirely, and doing a read-tree to repopulate it.

I'm curious what this use case is, and whether it would be acceptable to update something like ctime on the files to make them stat-dirty to git.

-Peff

author
#3 lore raw
Quoted 7 lines · Jeff King
Quoted 5 lines · Tomas Carnecky
Quoted 2 lines · Maaartin

There are files in my working tree which changes, but their size and mtime remains the same (I know it's strange, but it's useful). Can I make git to re-

When can this be useful?

Well, not really. I was asked to place a line containing a version number and a fingerprint in each file (of course the fingerprint must ignore this line), so I did. This gets done using a script, and I didn't like always saying "yes" to Emacs complaining about editing a file changed on the disk, so I reset the mtime. I really don't think it was the brightest idea ever.

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

read them all, so it recognizes the change? Ideally, using a configuration variable. The repo is fairly small, so speed is no issue here.

Try git update-index --refresh. I'm not aware of any config option, but you might want to look through man git-config.

That won't work, as it respects the stat information. So does --really-refresh. AFAIK, there isn't a way to tell update-index to ignore start information, short of blowing away the index entirely, and doing a read-tree to repopulate it.

Blowing away the index could work for me. I had to check if it's clean (equal to the HEAD or working tree) first, so I loose no work. But this is a bit too much work for making my mtime hack work.

Quoted 2 lines

I'm curious what this use case is, and whether it would be acceptable to update something like ctime on the files to make them stat-dirty to git.

I'd suppose, Emacs does the same checks.

#4 lore raw
In reply to Jeff King
Quoted 2 lines · Jeff King

I'm curious what this use case is, and whether it would be acceptable to update something like ctime on the files to make them stat-dirty to git.

Changing crlf-related attributes (or filter/smudge) after the fact, perhaps?