gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
953 stars 33 forks source link

Fix 'tach test' impact analysis when git root is not cwd #190

Closed emdoyle closed 1 month ago

emdoyle commented 1 month ago

Fixes an issue @max-muoto brought to my attention.

The bug manifested as a particular file change being mapped onto the wrong module, triggering almost the entire test suite when there should have been zero tests affected.

The issue was that the changed file detection assumed that git diff --name-status provided paths relative to the current working directory (similar to git status) but this is not the case. The paths are always relative to the git root, which means that later calls to resolve were creating incorrect paths relative to CWD.

This led to incorrect module paths being detected, and then incorrect tests being run.