Skip to content
Snippets Groups Projects
Commit c3c747a7 authored by Stan Hu's avatar Stan Hu
Browse files

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

Add tests that will pass if the test repo has a branch called 'fix-existing-submodule-dir'

See: https://gitlab.com/stanhu/gitlab-git-test/commits/add-submodule-to-existing-dir

Closes gitlab-org/gitlab-ce#1439
parent 4ce7663c
No related branches found
No related tags found
1 merge request!26Ignore submodules that are defined in .gitmodules but are checked in as directories
v 7.1.10
- Ignore submodules that are defined in .gitmodules but are checked in as directories.
v 7.1.9
- Ignore invalid lines in .gitmodules.
 
Loading
Loading
Loading
Loading
@@ -766,9 +766,12 @@ module Gitlab
raise InvalidBlobName.new("Invalid blob name: #{blob_name}")
end
 
if blob_entry[:type] == :commit
case blob_entry[:type]
when :commit
blob_entry[:oid]
else
when :tree
raise InvalidBlobName.new("#{blob_name} is a tree, not a blob")
when :blob
rugged.lookup(blob_entry[:oid]).content
end
end
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ describe Gitlab::Git::Branch do
subject { repository.branches }
 
it { should be_kind_of Array }
its(:size) { should eq(3) }
its(:size) { should eq(SeedRepo::Repo::BRANCHES.size) }
 
describe 'first branch' do
let(:branch) { repository.branches.first }
Loading
Loading
Loading
Loading
@@ -193,7 +193,7 @@ describe Gitlab::Git::Commit do
commits.map { |c| c.id }
end
 
it { should have(20).elements }
it { should have(22).elements }
it { should include(SeedRepo::Commit::ID) }
it { should include(SeedRepo::Commit::PARENT_ID) }
it { should include(SeedRepo::FirstCommit::ID) }
Loading
Loading
Loading
Loading
@@ -121,7 +121,7 @@ describe Gitlab::Git::Repository do
subject { heads }
 
it { should be_kind_of Array }
its(:size) { should eq(3) }
its(:size) { should eq(SeedRepo::Repo::BRANCHES.size) }
 
context :head do
subject { heads.first }
Loading
Loading
@@ -199,6 +199,11 @@ describe Gitlab::Git::Repository do
it 'should not have an entry for an invalid submodule' do
expect(submodules).not_to have_key('invalid/path')
end
it 'should not have an entry for an uncommited submodule dir' do
submodules = repository.submodules('fix-existing-submodule-dir')
expect(submodules).not_to have_key('submodule-existing-dir')
end
end
 
context 'where repo doesn\'t have submodules' do
Loading
Loading
module SeedRepo
module Repo
HEAD = "master"
BRANCHES = ["feature", "fix", "master"]
BRANCHES = ["feature", "fix", "fix-existing-submodule-dir", "master"]
TAGS = ["v1.0.0", 'v1.1.0', 'v1.2.0', 'v1.2.1']
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment