Draft: Add an option to select commits from refs/tags and refs/heads only
Contributes to gitlab#422152
Add an option to exclude commits from special references "refs/merge-requests", "refs/keep-around" and so on.
Problem
Commits API has an option "All" that returns commits from all branches and tags.
http://127.0.0.1:3000/api/v4/projects/84/repository/commits?all=true
On Gitaly side we call:
git log --all
However, it also returns commits from special references like refs/merge-requests/1/heads
. These references include "deleted" commits and that leads to confusion. Users see additional commits that they cannot find in their branches or tags.
Proposal
Add an option to exclude commits from special references and only return commits from refs/tags/*
and refs/heads/*
.
I discovered several ways how to achieve that:
- Use a combination of
branches
andtags
flags
git log --branches --tags
- Exclude special references from
--all
response
git log --exclude="refs/merge-requests/*" --exclude="refs/keep-around/*" --all
- Use glob flag to select only branches and tags.
git log --glob="refs/heads/*" --glob="refs/tags/*"
- Something else?
🤔
I don't have a strong preference which one to use and I'm open to suggestions.
Edited by Vasilii Iakliushin