git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Forcing re-reading files with unchanged stats

From
MMaaartin-1 <grajcar1@seznam.cz>
Date
Jan 14, 2011, 21:03 UTC
Message-ID
<4D30BA06.3090100@seznam.cz>
In-Reply-To
<20110113033217.GA32661@sigill.intra.peff.net>
On 11-01-13 04:32, Jeff King wrote:
Show 7 quoted lines
> On Thu, Jan 13, 2011 at 04:12:25AM +0100, Tomas Carnecky wrote:
> 
>>  On 1/12/11 3:07 PM, Maaartin wrote:
>>> 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.

Show 10 quoted 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.

> 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.
Previous: Junio C Hamano
Message 5 of 5 in “Forcing re-reading files with unchanged stats”
  1. MaaartinJan 12, 2011
  2. Tomas CarneckyJan 13, 2011
  3. Jeff KingJan 13, 2011
  4. Junio C HamanoJan 13, 2011
  5. Maaartin-1Jan 14, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.