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

fix: wrong git version hash calculated if source dirty #4483

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

dpc
Copy link
Contributor

@dpc dpc commented Mar 6, 2024

Mathz are hard.

Hey, at least it's not off by 1.

@dpc dpc requested a review from a team as a code owner March 6, 2024 21:06
@@ -66,7 +66,7 @@ fn set_code_version_inner() -> Result<(), String> {
// state by replacing the middle with 0s. This should
// be noticeable enough, while letting find out the
// root commit anyway.
format!("{}00000000{}", &hash[0..16], &hash[26..40])
format!("{}00000000{}", &hash[0..16], &hash[(40 - 16)..40])
Copy link
Member

@maan2003 maan2003 Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe 16+8 instead of 40 - 16

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree this would be easier to reason about at a glance if it were

[0..16], [(16+8)..40]

or even

let zeros_count = 8;
format!(
    "{}{}{}",
    &hash[0..16],
    "0".repeat(zeros_count),
    &hash[(16 + zeros_count)..40]
)

Copy link
Contributor Author

@dpc dpc Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The damage is done, no need to overthink it. When it was as a constant (incorrect at at) no one worried; now that it isn't (and actually gives the correct value), there's 10 ways to express it so bikesheding starts. :D

Just hit the green button :D

@dpc dpc enabled auto-merge March 6, 2024 22:55
@dpc dpc added this pull request to the merge queue Mar 7, 2024
Copy link
Contributor

@elsirion elsirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button-press-the-button

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2024
@maan2003 maan2003 added this pull request to the merge queue Mar 7, 2024
Merged via the queue into fedimint:master with commit 6cdfba8 Mar 7, 2024
20 checks passed
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 this pull request may close these issues.

None yet

4 participants