Commit 3c767f06 authored by Sean McGivern's avatar Sean McGivern Committed by Alejandro Rodríguez

Merge branch 'fix/github-importer' into 'master'

Fix GitHub importer to import PR where source repo/fork was renamed/deleted

Closes #24594

See merge request !7865
parent 74a750d3
---
title: Fix branch validation for GitHub PR where repo/fork was renamed/deleted
merge_request:
author:
......@@ -8,7 +8,7 @@ module Gitlab
end
def valid?
repo.present?
sha.present? && ref.present?
end
private
......
......@@ -49,14 +49,20 @@ describe Gitlab::GithubImport::BranchFormatter, lib: true do
end
describe '#valid?' do
it 'returns true when raw repo is present' do
it 'returns true when raw sha and ref are present' do
branch = described_class.new(project, double(raw))
expect(branch.valid?).to eq true
end
it 'returns false when raw repo is blank' do
branch = described_class.new(project, double(raw.merge(repo: nil)))
it 'returns false when raw sha is blank' do
branch = described_class.new(project, double(raw.merge(sha: nil)))
expect(branch.valid?).to eq false
end
it 'returns false when raw ref is blank' do
branch = described_class.new(project, double(raw.merge(ref: nil)))
expect(branch.valid?).to eq false
end
......
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