Skip to content

Commit a90cf9d

Browse files
authored
[ruff] Fix last_tag/commits_since_last_tag for version command (#16686)
## Summary Since Ruff changed to GitHub releases, tags are no longer annotated and `git describe` no longer picks them up. Instead, it's necessary to also search lightweight tags. This changes fixes the `version` command to give more accurate `last_tag`/`commits_since_last_tag` information. This only affects development builds, as this information is not present in releases. ## Test Plan Testing is a little tricky because this information changes on every commit. Running manually on current `main` and my branch: `main`: ``` # cargo run --bin ruff -- version --output-format=text ruff 0.9.10+2547 (dd2313a 2025-03-12) # cargo run --bin ruff -- version --output-format=json { "version": "0.9.10", "commit_info": { "short_commit_hash": "dd2313ab0", "commit_hash": "dd2313ab0faea90abf66a75f1b5c388e728d9d0a", "commit_date": "2025-03-12", "last_tag": "v0.4.10", "commits_since_last_tag": 2547 } } ``` This PR: ``` # cargo run --bin ruff -- version --output-format=text ruff 0.9.10+46 (11f39f6 2025-03-12) # cargo run --bin ruff -- version --output-format=json { "version": "0.9.10", "commit_info": { "short_commit_hash": "11f39f616", "commit_hash": "11f39f6166c3d7a521725b938a166659f64abb59", "commit_date": "2025-03-12", "last_tag": "0.9.10", "commits_since_last_tag": 46 } } ```
1 parent 58d5fe9 commit a90cf9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/ruff/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn commit_info(workspace_root: &Path) {
4949
.arg("-1")
5050
.arg("--date=short")
5151
.arg("--abbrev=9")
52-
.arg("--format=%H %h %cd %(describe)")
52+
.arg("--format=%H %h %cd %(describe:tags)")
5353
.output()
5454
{
5555
Ok(output) if output.status.success() => output,

0 commit comments

Comments
 (0)