Skip to content

Ignore submodules that are defined in .gitmodules but are checked in as directories

Stan Hu requested to merge stanhu/gitlab_git:fix-existing-submodule-dir into master

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