arxanas / git-branchless

High-velocity, monorepo-scale workflow for Git
Apache License 2.0
3.37k stars 80 forks source link

[Feature Request] Add a built-in function to revsets for searching file content changes, i.e. the commit diff #1338

Open mfulbright opened 1 month ago

mfulbright commented 1 month ago

I would find it useful to have a function that allows searching the contents of the diff of a commit. There are already built-in functions for searching by author name, email, etc., and searching file paths that were changed in the commit. A built-in for searching file content changes seems like a natural function to expose as well.

Perhaps it would be named contents.changed() to match the existing paths.changed() built-in: contents.changed(text-pattern): all commits with a change to any file contents matching the specified pattern

And/or, breaking it out into 2 functions that specifically search additions and removals could be useful as well: contents.added(text-pattern): all commits with an addition to any file contents matching the specified pattern contents.removed(text-pattern): all commits with a removal to any file contents matching the specified pattern