facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.64k stars 992 forks source link

Feature Request: Field providing the git object format hash of the content #1164

Open tomgasson opened 1 year ago

tomgasson commented 1 year ago

In local development, we use watchman to create content-addressed incremental state. It's great because it allows us to use subscriptions and respond to the working directory changes.

In CI for similar needs, we use git index itself which entirely avoids walking the filesystem. Here we don't need subscriptions or to handle working directory changes.

Unfortunately we can't use these interchangeably because they work of different content hashes. We get Map<content.sha1hex, FileInfo> from watchman We get Map<GitObjectHash, FileInfo> from the git index git ls-tree -r <ref>

We'd like to be able use the same incremental state across both strategies.

This request is to introduce a additional field to watchman (content.githashhex?), very similar to the existing content.sha1hex but returning the files git object hash (sha1("blob " + filesize + "\0" + data)) rather than content.sha1hex (sha1(data)).

Would you accept a contribution of this feature?

keycommander commented 12 months ago

Still reviewing lots of things that are critical to my experience.