1
0
Fork
You've already forked watch-git
0
Some scripts to watch specific pieces of specific git projects on any accessible repo.
  • Rust 92.8%
  • Gherkin 7.2%
Rob Williamson a3c83ab3b3
Add Tracing and fix Test Failures
And some instructions how to trace.
Also, the test failure revealed a missing feature about change executor
matching and parameter substitution.
2026年07月12日 10:54:19 +02:00
dev-tools WIP Switch to Anyhow errors, do some better testing, not finished. 2026年07月12日 10:54:19 +02:00
src Add Tracing and fix Test Failures 2026年07月12日 10:54:19 +02:00
tests Add Tracing and fix Test Failures 2026年07月12日 10:54:19 +02:00
.gitignore WIP Mostly Working 2026年07月12日 10:54:19 +02:00
Cargo.lock WIP Switch to Anyhow errors, do some better testing, not finished. 2026年07月12日 10:54:19 +02:00
Cargo.toml WIP Switch to Anyhow errors, do some better testing, not finished. 2026年07月12日 10:54:19 +02:00
coverage-threshold Add Tracing and fix Test Failures 2026年07月12日 10:54:19 +02:00
example.config.yml WIP Mostly Working 2026年07月12日 10:54:19 +02:00
LICENSE Initial commit 2026年07月12日 10:54:13 +02:00
prek.toml Initial commit 2026年07月12日 10:54:13 +02:00
README.md Add Tracing and fix Test Failures 2026年07月12日 10:54:19 +02:00

Watch Git

A Rust based tool for watching specific parts of git repositories, and triggering local events on a change.

Git remotes can be specified with regular expressions matching branch patterns and path patterns. Matches trigger user-specified commands.


How to Build & Run

Prerequisites

Install Rust, then install coverage and pre-commit tools:

# Install cargo-llvm-cov & nightly toolchain for coverage
rustup toolchain install nightly
rustup component add llvm-tools --toolchain nightly
cargo install cargo-llvm-cov
# Install cargo-mutants for mutation testing
cargo install cargo-mutants
# Install prek
cargo install prek

Building & Running

cargo build # Debug build
cargo build --release # Release build
cargo run # Run the CLI binary

CLI Commands

cargo run -- watch-git init # Walks you through creating a config.yml to watch your repositories.
cargo run -- watch-git validate # Validates your config.yml, and tells you what's wrong if there's a problem.
cargo run -- watch-git list # Lists the repositories config.yml tells watch-git to watch.
cargo run -- watch-git start # Starts watch-git watching the repositories specified in config.yml

Testing

Run all unit tests:

cargo test --all-features
  • Unit tests: Located in src/lib.rs and dev-tools/src/bin/cargo-covcheck.rs.

Coverage & Mutation Testing

Branch Coverage

cargo run -p dev-tools --bin cargo-covcheck

Threshold is set in coverage-threshold. Results via cargo +nightly llvm-cov --branch --html.

Mutation Testing

cargo run -p dev-tools --bin cargo-mutcheck

Review mutants.out/missed.txt for surviving mutations; strengthen tests accordingly.


Pre-commit Hooks

Set up hooks in this repository:

prek install

Once set up, these checks run automatically on every commit:

  • cargo fmt --check (auto-formats on failure)
  • cargo test --all-features
  • cargo run -p dev-tools --bin cargo-covcheck

Run manually:

prek run --all-files

Contributing

  1. Format: cargo fmt
  2. Test: cargo test --all-features
  3. Verify Coverage & Mutations:
    • Coverage: cargo run -p dev-tools --bin cargo-covcheck
    • Mutation: cargo run -p dev-tools --bin cargo-mutcheck
  4. Hooks: Ensure prek run --all-files passes.
  5. Open a Pull Request with your changes.

Tracing tip

src/macros.rs contains a trace macro that is disabled by default. Replace NO_LOG with LOG to activate this, but don't check that change in.


Workspace Structure

  • src/ - Main library and binary
  • dev-tools/ - Helper utilities for coverage and mutation testing