#!/usr/bin/env ruby
# frozen_string_literal: true

SOURCE = 'gitlab.com/gitlab-org/gitaly-proto'

proto_source = File.read('proto/SOURCE').chomp
if proto_source != SOURCE
  abort "gitaly-proto must be vendored from #{SOURCE}"
end

proto_revision = File.read('proto/REVISION')

# good: v1.2.3
# bad: v1.2.3-2019234234-a35478eff90
if proto_revision =~ /^v[0-9.]+$/
  puts 'OK'
  exit
end

abort 'error: no tagged version of gitaly-proto found in proto/'
