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

Re: Tracking file metadata in git -- fix metastore or enhance git?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 10, 2011, 00:15 UTC
Message-ID
<20110410001518.GA6380@elie>
In-Reply-To
<BANLkTim5DPjGjJ=SfnNfXpzCd6=PKnSs6g@mail.gmail.com>
Hi again.
Chris Webb wrote:
> (Disclaimer: I've never tried using smudge filters; maybe they can't be used
> in the way I describe!)

In the current form, they couldn't. smudge/clean filters take their input through stdin and write their output to stdout --- there is not a chance to look at the on-disk directory entry to get metadata.

It might be possible to introduce a new %p substitution pointing to the actual file the filter is working on, since with a few exceptions, the file passed to a clean filter is already on-disk. Exceptions:

 * "git blame --contents=- -- <path>" reads from stdin instead of <path>.
 * the low-level --renormalize facility (see git-merge(1)) and its
   callers feed a clean filter with output from a smudge filter before
   content hits the disk.
 * "git hash-object --path=<path> --stdin" reads from stdin instead of
   <path>.

I'd be worried about using a clean filter to store timestamps. Treating a file as changed whenever mtime changes could be confusing. Treating atime changes as content changes would be even stranger.

Richard Hartmann wrote:
> One large question in my mind is if anyone who's familiar enough with
> the codebase and has the time would be interested in actually
> implementing this.

I don't think this has to touch git core, except perhaps as mentioned above. Please feel free to cc me if working on hooks (pre-commit hook or clean filter) to automatically track metadata and some mechanism to restore it. I'd be glad to give feedback and help in any other way I can.

To be clear, I will not be driving this forward --- it's just not something I've ever needed, so I'd trust others to do a better job of taking good care of the actual use cases.

Ciao, Jonathan

Previous: Richard HartmannNext: Junio C Hamano
Message 12 of 19 in “Tracking file metadata in git -- fix metastore or enhance git?”
  1. Richard HartmannApr 7, 2011
  2. Thorsten GlaserApr 7, 2011
  3. Richard HartmannApr 8, 2011
  4. Michael J GruberApr 8, 2011
  5. Jonathan NiederApr 8, 2011
  6. Thorsten GlaserApr 8, 2011
  7. Jonathan NiederApr 8, 2011
  8. Thorsten GlaserApr 8, 2011
  9. Richard HartmannApr 8, 2011
  10. Chris WebbApr 9, 2011
  11. Richard HartmannApr 9, 2011
  12. Jonathan NiederApr 10, 2011
  13. Junio C HamanoApr 10, 2011
  14. Richard HartmannApr 10, 2011
  15. Richard HartmannApr 11, 2011
  16. Richard HartmannApr 18, 2011
  17. Jonathan NiederApr 18, 2011
  18. johnnyutahhDec 14, 2011
  19. Richard HartmannDec 20, 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.