Backup/Restore breaks .gitattributes functionality
Summary
Our Gitlab projects use .gitattributes
file to suppress some diff info on merge-requests
.
Creating a full Gitlab system backup with defaults, and then restoring it on a new fresh Gitlab instance, diff info supression stops working even though the .gitattribute
file is commited on master branch.
Steps to reproduce
Create a project with .gitattributes
in it, do a backup of the system, and then restore the backup on a fresh Gitlab instance.
What is the current bug behavior?
If you look up on Gitlab
file system, for each repository, you will find a info
folder, where contents of .gitattributes
are copied to a attributes
file:
$ ls -la /var/opt/gitlab/git-data/repositories/myproject.git/info
$ drwxr-xr-x. 2 git git 4096 Aug 6 13:11 .
$ drwxrwx---. 7 git git 4096 Aug 6 13:13 ..
$ -rw-r--r--. 1 git git 16 Aug 6 13:13 attributes
$ -rw-r--r--. 1 git git 113 May 9 10:35 exclude
$ -rw-r--r--. 1 git git 37517 Aug 6 13:11 refs
When you do a restore, looking again in the same folder, you only get an autogenerated exclude
file, and the other files that should be there are missing.
If you recreate manually attributes
file, then everything works as expected.
My guess is that when you restore a backup, the logic that should copy contents of .gitattributes
to (GITLAB_DATA)/repositories/myproject.git/info/attributes
is not executed.
What is the expected correct behavior?
After a restore, .gitattributes
file should be honored.
Results of GitLab environment info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.3.7p456
Gem Version: 2.6.14
Bundler Version:1.13.7
Rake Version: 12.3.1
Redis Version: 3.2.11
Git Version: 2.16.4
Sidekiq Version:5.0.5
Go Version: unknown
GitLab information
Version: 10.8.4-ee
Revision: f80a528
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.8
URL: http://xxxxxxxxxxxxxxx.com
HTTP Clone URL: http://xxxxxxxxxxxxxxx.com/some-group/some-project.git
SSH Clone URL: git@xxxxxxxxxxxxxxx.com:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 7.1.2
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git