Skip to content

Support using full hexsha as default gitRevision value #2529

Closed
@chenxinyanc

Description

@chenxinyanc

Search Terms

full gitRevision

Problem

I want to set up git links to our git repo hosted on Azure DevOps (VSTS) with the following sourceLinkTemplate:

https://dev.azure.com/<org-name>/<project-name>/_git/<repo-name>?path={path}&version=GC{gitRevision}&line={line}

However, the generated link is invalid because {gitRevision} is replaced by the prefix of hexsha (e.g. 30e614c) instead of the full hexsha (e.g. 30e614cd9e7b5a154afa6a78f2e54f16550bfb4f).

It turns out that the gitRevision preset is using the short hexsha.

gitRevision ||= git(
"-C",
path,
"rev-parse",
"--short",
"HEAD",
).stdout.trim();

Is it possible to let us specify to use full hexsha in this case?

Suggested Solution

  • provide an option to use full hexsha as default gitRevision,
  • or change the default behavior of gitRevision to use full hexsha, but to allow us specify whether to use full hexsha value or only the prefix of it in sourceLinkTemplate, e.g., {gitRevision:short}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions