From a07ba5a42b97feaebcd842a256b8b19f149108d8 Mon Sep 17 00:00:00 2001 From: Mi-Amore-Cadenza <100969190+Mi-Amore-Cadenza@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:43:08 -0800 Subject: [PATCH] Update "dirty" file only when `GitIsDirty` changes This change fixes what looks like a bug in the current implementation of the `_GitRoot` target: namely, that the target always appends a `0` or `1`, on a new line, to the `_GitIsDirtyFile` every time said target runs, causing all other targets that depend on it as an input to always rerun as well. Ultimately, this breaks incremental builds of projects that rely on the `GitInfo` package. With this change, the `_GitIsDirtyFile` behaves as its logic appears to have been intended to: instead of always appending the current value of `$(GitIsDirty)` to the file, the current value of `($GitIsDirty)` will replace the file's contents if and only if the value differs from what's already in the file. Otherwise, the file remains untouched and all other targets that use it as an input will function as expected in incremental builds. This fixes or at least significantly mitigates the problems described in #183. --- src/GitInfo/build/GitInfo.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitInfo/build/GitInfo.targets b/src/GitInfo/build/GitInfo.targets index 4f068ac..1b76e3e 100644 --- a/src/GitInfo/build/GitInfo.targets +++ b/src/GitInfo/build/GitInfo.targets @@ -339,7 +339,7 @@ 0 - +