Commit 003f140c authored by Mike Greiling's avatar Mike Greiling

ensure fork_source returns nil when project is the root fork, add tests

parent 1eefc384
...@@ -1032,6 +1032,8 @@ class Project < ActiveRecord::Base ...@@ -1032,6 +1032,8 @@ class Project < ActiveRecord::Base
end end
def fork_source def fork_source
return nil unless forked?
forked_from_project || fork_network&.root_project forked_from_project || fork_network&.root_project
end end
......
...@@ -1951,6 +1951,10 @@ describe Project do ...@@ -1951,6 +1951,10 @@ describe Project do
expect(second_fork.fork_source).to eq(project) expect(second_fork.fork_source).to eq(project)
end end
it 'returns nil if it is the root of the fork network' do
expect(project.fork_source).to be_nil
end
end end
describe '#lfs_storage_project' do describe '#lfs_storage_project' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment