Skip to content

git hash in build-info version is not as stable as it could be #4855

@jberdine

Description

@jberdine

Expected Behavior

Build_info.V1.version returns the same string when the same commit is checked out, no matter the other state of the clone.

Actual Behavior

The number of characters in the git commit hash component of Build_info.V1.version can vary.

Reproduction

I do not know a reliable way to reproduce this. The root cause of this issue is that the git describe --always --dirty command that dune invokes internally to populate the build info version depends on the state of the clone. In particular, git automatically includes more than 7 characters in order to make the hash prefix unique. This seems to take into consideration local commits, stashes, to-be-gced commits, etc. It would be more robust to explicitly specify the desired length using the --abbrev=<n> flag for some n that is uniform at least across versions of the build info library.

Specifications

  • Version of dune (output of dune --version): 2.9.0
  • Version of ocaml (output of ocamlc --version): 4.12.0
  • Operating system (distribution and version): linux and macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions