vergen is emitting cargo:rerun-if-changed=.git/ which is causing our build script to be executed whenever any file under the .git directory changes. This is causing excessive rebuilds.
According to the docs, vergen should be emitting rerun-if-changed=.git/HEAD and rerun-if-changed=.git/<ref>, where <ref> is the name of the ref that HEAD resolves to. In my case, instead of .git/<ref> I see only .git/.
vergen
is emittingcargo:rerun-if-changed=.git/
which is causing our build script to be executed whenever any file under the.git
directory changes. This is causing excessive rebuilds.According to the docs, vergen should be emitting
rerun-if-changed=.git/HEAD
andrerun-if-changed=.git/<ref>
, where<ref>
is the name of the ref thatHEAD
resolves to. In my case, instead of.git/<ref>
I see only.git/
.This appears to be due to this line in
add_rerun_if_changed
https://github.com/rustyhorde/vergen/blob/4d78e165e8005769732c387cdc967b528d8b3f02/vergen-git2/src/git2/mod.rs#L522This should instead be
path.display()
:ref_path
points to the.git
directory itself.