cargo-mutants icon indicating copy to clipboard operation
cargo-mutants copied to clipboard

`--in-git-diff` convenience option

Open sourcefrog opened this issue 1 year ago • 2 comments

For example in a PR or working branch, allow cargo mutants --in-git-diff main, and just run git diff in a subprocess.

sourcefrog avatar Jan 14 '24 05:01 sourcefrog

There is also crate for Git interaction which is capable of querying the diffs, as well; https://github.com/rust-lang/git2-rs. Might this be an option, as well?

kevinmatthes avatar Jan 14 '24 15:01 kevinmatthes

That could be an option too, thanks.

The main advantage of using git2-rs that I can think is is that it'll work if there's no git binary available, which seems probably unlikely on machines where people would want to use this. On the downside, it probably pulls in a few compile time dependencies, increasing build time and binary size.

I don't think we'd need anything that would not be easily accessible through the CLI as really just a diff is enough, and it's not performance intensive: we run it only once and it should be trivial time compared to actually generating and running the mutants...

sourcefrog avatar Jan 14 '24 17:01 sourcefrog