File commit history not showing for subtree files
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When using subtree, commit history is shown when viewing a file's Blame in the UI, but not the file's History. The commit history for the file is empty.
It seems like --follow -m
is needed to show the commit history using git log
. It seems we use --follow
, but not -m
:
https://gitlab.com/gitlab-org/gitaly/-/blob/20fe02e33885f459cddfb32717e02141d01ab12f/internal/gitaly/service/commit/find_commits.go#L258-260
$ git blame -c -p .tmike/zd438789/zd438789/testfile
2cd37a087c08bc23154e0ae92f728bd42d550b12 1 1 2
author Michael Trainor
author-mail <mtrainor@gitlab.com>
author-time 1691709379
author-tz +0000
committer Michael Trainor
committer-mail <mtrainor@gitlab.com>
committer-time 1691709379
committer-tz +0000
summary Update file testfile
filename testfile
This is a test file
2cd37a087c08bc23154e0ae92f728bd42d550b12 2 2
493581f93d6d763b69cbd7aba645b991cc135c6c 3 3 1
...
$ git log --format=%H --follow -m .tmike/zd438789/zd438789/testfile
50e276e09ccacb5628bd67b4b3f2771f87087fb0
50e276e09ccacb5628bd67b4b3f2771f87087fb0
f152ea3f93fcc08078fcf246b8ad4fe5e284e95f
493581f93d6d763b69cbd7aba645b991cc135c6c
7e32ecd77537a022901215f925ac9c52eafade8c
2cd37a087c08bc23154e0ae92f728bd42d550b12
$ git log --format=%H --follow .tmike/zd438789/zd438789/testfile
<nothing>
Steps to reproduce
- Create an upstream repository with files and some commit history.
- Create a "downstream" repository.
- Use
git subtree add
- Push changes to downstream repository
- Open downstream project in GitLab
- View a file added from the upstream and click Blame
- View a file added from the upstream and click History
Example Project
What is the current bug behavior?
Blame shows history, History does not (empty)
What is the expected correct behavior?
History should show commit history if Blame does
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
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)