gitlab-rake gitlab:import:repos error on repo with empty wiki
Summary
Error occurs when importing repo.git
with empty repo.wiki.git
via gitlab-rake gitlab:import:repos[]
.
Steps to reproduce
Here is the script:
#!/bin/bash
dir=/tmp/gittest
mkdir -p $dir/{succ,fail}/user
# make a repo with one commit
(git init $dir/repo && (echo data > $dir/repo/file) && (cd $dir/repo && git add -A && git commit -am "repo with commit"))
# test 1 that can succeed
git clone --mirror $dir/repo $dir/succ/user/repo0.git
sudo chown -R git:git $dir
gitlab-rake gitlab:import:repos["$dir/succ"]
# test 2 that fails
git clone --mirror $dir/repo $dir/fail/user/repo1.git
git init --bare $dir/fail/user/repo1.wiki.git
sudo chown -R git:git $dir
gitlab-rake gitlab:import:repos["$dir/fail"]
Example Project
None
What is the current bug behavior?
The import is interrupted by error.
What is the expected correct behavior?
The import should finish successfully, ignoring the empty wiki repo.
Relevant logs and/or screenshots
This is the main output of reproduce.sh
:
Processing /tmp/gittest/succ/user/repo0.git
* Using namespace: user
* Created repo0 (user/repo0)
Processing /tmp/gittest/fail/user/repo1.git
* Using namespace: user
* Failed to move repo: fatal: Refusing to create empty bundle.
* Failed trying to create repo1 (user/repo1)
* Skipping repo /tmp/gittest/fail/user/repo1.wiki.git
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
$ sudo gitlab-rake gitlab:env:info
System information System: Debian 9.4 Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.18.0 Sidekiq Version:5.1.3 Go Version: unknown
GitLab information Version: 11.2.3 Revision: 06cbee3 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://192.168.13.106 HTTP Clone URL: http://192.168.13.106/some-group/some-project.git SSH Clone URL: git@192.168.13.106:some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 8.1.1 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
$ sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab Shell ...
GitLab Shell version >= 8.1.1 ? ... OK (8.1.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 1/2 ... ok 1/7 ... ok 1/8 ... ok 1/9 ... ok 1/10 ... ok 4/13 ... ok 4/14 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 1/2 ... yes 1/7 ... yes 1/8 ... yes 1/9 ... yes 1/10 ... yes 4/13 ... yes 4/14 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.18.0) Git user has default SSH configuration? ... yes Active users: ... 1
Checking GitLab ... Finished
Possible fixes
When mv_repo
for the wiki fails due to emptiness, the whole import should go on instead of being aborted.
the code: mv_repo for wiki