# chore: Fix spurious rebuilds of Zed library and binary \(\#3952\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/dd730549df0794de8945afcaf3c28fd9c4476257)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: dd730549df0794de8945afcaf3c28fd9c4476257

Requested commit: dd730549df0794de8945afcaf3c28fd9c4476257

Commit: dd730549df0794de8945afcaf3c28fd9c4476257

Tree: bf2378120326cd170e209e62cafc5462b5b37221

Author: Piotr Osiewicz

Committer: GitHub

## Message

````
chore: Fix spurious rebuilds of Zed library and binary (#3952)

Currently when one runs `cargo build` twice without changing anything,
zed lib and binary are gonna get rebuilt every time. I checked out cargo
logs and it turns out we were querying wrong path to `.git/logs/HEAD` in
our build.rs, causing it to rerun on every build and thus marking zed
lib as dirty.

See logs (`CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo
build`):
```
0.501173792s  INFO cargo::core::compiler::fingerprint: fingerprint dirty for zed v0.120.0 (/Users/hiro/Projects/zed/crates/zed)/RunCustomBuild/TargetInner { ..: custom_build_target("build-script-build", "/Users/hiro/Projects/zed/crates/zed/build.rs", Edition2021) }
0.501180417s  INFO cargo::core::compiler::fingerprint:     dirty: FsStatusOutdated(StaleItem(MissingFile("/Users/hiro/Projects/zed/crates/zed/.git/logs/HEAD")))
```
The path to .git directory is relative to crates/zed and not to the
workspace's root.

/cc @maxbrunsfeld 

Release Notes:
- N/A
````

## Parents

- [8214a7f6567a61216479f9ab05e48bd6e2af21ef](https://git.cafe/gitcafe/zed/commit/8214a7f6567a61216479f9ab05e48bd6e2af21ef?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/dd730549df0794de8945afcaf3c28fd9c4476257?format=markdown)
