Ignore submodules that are defined in .gitmodules but are checked in as directories
Check that a blob entry is a not a tree (aka directory). It's possible to check in a submodule in .gitmodules but not the actual directory, leading to a 500 Error in GitLab.
See: https://gitlab.com/stanhu/gitlab-git-test/commits/add-submodule-to-existing-dir and click Files to see the error.
NOTE: Don't merge this gitlab-git-test change into master; put it in another branch called fix-existing-submodule-dir
. I could not get the gitlab_git tests to pass with master because the git checkout to the feature branch caused libgit2 to complained about a conflict, even though git checkout -b foo_branch origin/feature
works fine. Apparently git uses no code in libgit2, which might explain the discrepancy. I suspect libgit2 sees the mismatched submodule directory as a conflict.
Closes: gitlab-org/gitlab-ce#1439 (duplicate here: https://github.com/gitlabhq/gitlabhq/issues/9140)
Merge request reports
Activity
I figured out how to make this work. I just put the broken state into another branch in the test-repo called
fix-existing-submodule-dir
.I think all that needs to be done is to merge https://gitlab.com/stanhu/gitlab-git-test/commits/add-submodule-to-existing-dir into a branch called
fix-existing-submodule-dir
before merging this change.Can you take a look at this one, @DouweM?
This is what I propose:
git clone https://gitlab.com/gitlab-org/gitlab-git-test.git cd gitlab-git-test git remote add stanhu https://gitlab.com/stanhu/gitlab-git-test.git git pull stanhu add-submodule-to-existing-dir git checkout -b fix-existing-submodule-dir stanhu/add-submodule-to-existing-dir git push -u origin fix-existing-submodule-dir
Nice, error reproduced here: https://gitlab.com/gitlab-org/gitlab-git-test/tree/fix-existing-submodule-dir :)
Added 1 commit:
- c3c747a7 - Ignore submodules that are defined in .gitmodules but are checked in as directories.
mentioned in commit 3d5a6b91