Skip to content

Replacing shas in raw text fields based on the first 7 chars #9

@pmartindev

Description

@pmartindev

Currently, all comparisons are done against the full text of the sha in the json objects vs the old sha in the commit-map. While this is valid for specified sha json object fields, there are certain raw text fields in GitHub that will reference short shas. An example would be in the body of an issue where the author can specify the full sha 7b72e8e the short sha 7b72e8e or anything in between 7b72e8e and GitHub will link to that commit. Anything less than 7 chars is considered not unique enough, and won't be linked 7b72. I would propose:

  1. Identify raw text fields in the metadata files (ex: issue body text) that should be replaced
  2. Add an optional bool flag --replace-text, -r defaulted to false that would give users the option whether to replace shas in these fields
  3. Change the comparison to only compare the first 7 chars of a metadata sha field with the first 7 chars of the commit-map sha field, and replace the value equal to the length of metadata sha with the equivalent length of the old sha
  4. Split the metadata text fields (probably on non-hex characters?) and compare the first 7 chars of each value with the first 7 of the old sha and replace the value equal to the length of metadata sha with the equivalent length of the old sha

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