Skip to content

vcs: fix RefDescriptions output for tag refs to print commit objname rather than tag objname

Warren Gifford requested to merge nsc/refdescriptions-tag-fix into main

Created by: Strum355

From git: for-each-ref: "If fieldname is prefixed with an asterisk (*) and the ref points at a tag object, use the value for the field in the object which the tag object refers to (instead of the field in the tag object)."

Example: v3.36.1 is tagged at the commit a702958ce54aeb141b820662e0f0167011e9a610.

  • Running git for-each-ref --format='%(objectname):%(refname):%(HEAD):%(creatordate:iso8601-strict)' 'refs/heads/' 'refs/tags/' | grep a702958ce54aeb141b820662e0f0167011e9a610 returns no results.
  • Running git for-each-ref --format='%(objectname):%(refname):%(HEAD):%(creatordate:iso8601-strict)' 'refs/heads/' 'refs/tags/' | grep '3.36.1:' returns one result, 95eb0e56f6390f12d88292fdd32da32756bc1af1:refs/tags/v3.36.1: :2022-01-21T13:07:22-05:00. Notice thats a different hash than the commit hash the tag supposedly points to.
  • Running git for-each-ref --format='%(*objectname):%(refname):%(HEAD):%(creatordate:iso8601-strict)' 'refs/heads/' 'refs/tags/' | grep '3.36.1:' returns one result, a702958ce54aeb141b820662e0f0167011e9a610:refs/tags/v3.36.1: :2022-01-21T13:07:22-05:00. This is the expected output, with the commit hash the tag points to.

This probably adversely affected the tag policy matcher, probably making it not effective has the commit map insert would insert the tag object hash while the commit map lookup wouldn't return any tag policy matches as theyd be under a different key

Merge request reports

Loading