References of a commit resource behaves unexpected
Summary
I used the following API resource https://docs.gitlab.com/ee/api/commits.html#get-references-a-commit-is-pushed-to to list all tags associated to a certain commit. It showed that this API also lists tags for unrelated commits, as shown in my demo repository. From the documentation I assumed that this resoucrce works like git tag --points-at <commit-sha>
, which it didn't.
we have an internal deployment tool that tries to resolve a tag to a certain commit, if it exists.
Lets say I deploy serviceX
in revision c15cbf97d1d0f82b90ff1e44b61071e8a89eae39
it tries to determine the tag that is assigned to this commit, e.g. v1.2.3
.
This works perfectly fine using git tag --points-at c15cbf97d1d0f82b90ff1e44b61071e8a89eae39
but requires to have the git repository context on the machine running the deploy tool, which would not be required if I could retrieve this information easily from the Gitlab API.
Steps to reproduce
I created a minimal example that demonstrates the issue: https://gitlab.com/klingtnet/commit-refs-bug-demo.
Example Project
https://gitlab.com/klingtnet/commit-refs-bug-demo
What is the current bug behavior?
Tags are shown for untagged commits.
What is the expected correct behavior?
Tags are only shown as references if the commit is actually tagged.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
The demo repository uses the current gitlab.com API.
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)