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

feat(nargo): include short git commit in cli version output #721

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

TomAFrench
Copy link
Member

@TomAFrench TomAFrench commented Feb 1, 2023

Related issue(s)

Resolves #720

Description

Summary of changes

I've added some macros which append the current git hash onto the version returned by clap so we now get the output:

$ nargo --version
nargo 0.1.0 (git:d4154364)

If there are uncommitted changes to the repo then the git hash is suffixed with -dirty to alert us that it's not running the exact code from that commit.

At the same time, I've made clap always pull the version from cargo.toml so we don't need to manually keep this in sync.

Dependency additions / changes

The following dependencies are added to nargo:

  • git_version as this allows us to get the git hash in a non-hacky way which handles incremental compilation correctly.
  • const_format in order to format the cargo version and git hash together.

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Additional context

@TomAFrench TomAFrench requested a review from kobyhallx February 1, 2023 00:50
@guipublic
Copy link
Contributor

If there are uncommitted changes to the repo then the git hash is suffixed with -dirty to alert us that it's not running the exact code from that commit.

Can you explain this? If changes are not committed, then obviously it is not part of the commit, so I don't understand.

@TomAFrench
Copy link
Member Author

TomAFrench commented Feb 1, 2023

Yes but if I check out a particular commit, make a bunch of changes to the code, and then build nargo without committing those changes then nargo would still report that same commit hash despite it no longer corresponding to the code being run. This is potentially misleading so adding a suffix seems sensible.

@kevaundray kevaundray merged commit 6e01c2f into master Feb 1, 2023
@kevaundray kevaundray deleted the include-hash-in-version branch February 1, 2023 12:36
TomAFrench added a commit that referenced this pull request Feb 3, 2023
* master:
  Rename methods that use `conditionalize` to be more descriptive (#739)
  feat(noir)!:  Returned values are no longer required by the prover (#731)
  chore: explicit versions for dependencies (#727)
  chore: readability improvements (#726)
  feat(nargo): include short git commit in cli version output (#721)
  Remove print to console for named proofs in `nargo prove` (#718)
  chore: clean up serde-related dependencies (#722)
  Handle out-of-bound errors in CSE (#471) (#673)
  Remove unused dependencies and only use workspace inheritance on shared deps (#671)
  feat(std_lib)!: modulus bits/bytes methods, and to_bits -> to_le_bits (#697)
  Implement numeric generics (#620)
  Review some TODO in SSA (#698)
  Replace `toml_map_to_field` and `toml_remap` with traits to map between `InputValue`s and `TomlTypes` (#677)
  Apply witness visibility on a parameter level rather than witness level (#712)
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.

Nargo Version Hash
3 participants