Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_tools_util: does not emit any "rerun-if-changed" #13312

Closed
RalfJung opened this issue Aug 26, 2024 · 4 comments · Fixed by #13329
Closed

rustc_tools_util: does not emit any "rerun-if-changed" #13312

RalfJung opened this issue Aug 26, 2024 · 4 comments · Fixed by #13329

Comments

@RalfJung
Copy link
Member

In Miri, a while ago we replaced vergen by rustc_tools_util. However, unlike vergen, rustc_tools_util does not emit any "rerun-if-changed" and therefore the git hash it shows will not be properly updated on rebuilds.

@matthiaskrgr
Copy link
Member

hmmm, never noticed this myself 😅
I checked how vergen does this and but the proposed cargo:rerun-if-changed=.git/HEAD is equally broken, as this the file is only modified, when you SWITCH a branch.

However, when you do an empty commit on top of your current branch, you stay on the same branch/symbolic ref ref: refs/heads/master so git does not see any reason to touch the file (and rightfully so).
Thus not a regression? :P

@matthiaskrgr
Copy link
Member

Right now i'm not sure if this can be solved while

  1. making sure an empty commit retriggers a build
  2. making sure when crate sources are NOT from a git repo root (crates io or rustc subrepo, basically no .git/), we do not trigger a rebuild every single time because the .git is not found

:/

@samueltardieu
Copy link
Contributor

Wouldn't this cover all cases?

  • Check if .git/HEAD is present, and if it is rerun-if-changed for .git/HEAD
  • And in this case, if git/HEAD contains a ref: REF_PATH, rerun-if-changed for $REF_PATH

@RalfJung
Copy link
Member Author

RalfJung commented Sep 1, 2024

Yeah that seems to be what vergen does as well:

bors added a commit that referenced this issue Oct 7, 2024
rustc_tools_util: rerun when git commit changes

Fixes #13312
@bors bors closed this as completed in 6f4bf90 Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants