ensure fork_source returns nil when project is the root fork, add tests
This commit is contained in:
parent
1eefc384a4
commit
003f140ce7
2 changed files with 6 additions and 0 deletions
|
@ -1032,6 +1032,8 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def fork_source
|
||||
return nil unless forked?
|
||||
|
||||
forked_from_project || fork_network&.root_project
|
||||
end
|
||||
|
||||
|
|
|
@ -1951,6 +1951,10 @@ describe Project do
|
|||
|
||||
expect(second_fork.fork_source).to eq(project)
|
||||
end
|
||||
|
||||
it 'returns nil if it is the root of the fork network' do
|
||||
expect(project.fork_source).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lfs_storage_project' do
|
||||
|
|
Loading…
Reference in a new issue