Skip to content

Commit

Permalink
CHECK-VERSIONS: Allow to specify short commit numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
lephilousophe committed Jun 30, 2024
1 parent c1c70c3 commit a503ea9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion check-versions/git_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def fetch_refs(repository, context=None):
refs = parse_dumb_refs(reply)
return refs

def git_commit(version, *, repository, branch, context=None):
def git_commit(version, *, repository, branch, context=None, short=False):
refs = fetch_refs(repository, context)

ref_name = 'refs/heads/{0}'.format(branch)
Expand All @@ -132,6 +132,9 @@ def git_commit(version, *, repository, branch, context=None):
if obj is None:
raise Exception("Invalid branch {1} specified for {0}".format(repository, branch))

if short and len(version) >= 7:
obj = obj[:len(version)]

return obj == version, obj, "repository URL: {0} branch {1}".format(repository, branch)

checkers.register('git commit', git_commit)
Expand Down

0 comments on commit a503ea9

Please sign in to comment.