Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ec4b03a4
Commit
ec4b03a4
authored
Mar 07, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'Object not found - no match for id (sha)' when importing GitHub PRs
parent
0cc4afc9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
lib/gitlab/github_import/branch_formatter.rb
lib/gitlab/github_import/branch_formatter.rb
+1
-1
spec/lib/gitlab/github_import/branch_formatter_spec.rb
spec/lib/gitlab/github_import/branch_formatter_spec.rb
+6
-6
spec/lib/gitlab/github_import/importer_spec.rb
spec/lib/gitlab/github_import/importer_spec.rb
+1
-1
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+6
-6
No files found.
lib/gitlab/github_import/branch_formatter.rb
View file @
ec4b03a4
...
...
@@ -18,7 +18,7 @@ module Gitlab
end
def
commit_exists?
project
.
repository
.
commit
(
sha
).
present?
project
.
repository
.
branch_names_contains
(
sha
).
include?
(
ref
)
end
def
short_id
...
...
spec/lib/gitlab/github_import/branch_formatter_spec.rb
View file @
ec4b03a4
...
...
@@ -6,27 +6,27 @@ describe Gitlab::GithubImport::BranchFormatter, lib: true do
let
(
:repo
)
{
double
}
let
(
:raw
)
do
{
ref:
'
feature
'
,
ref:
'
branch-merged
'
,
repo:
repo
,
sha:
commit
.
id
}
end
describe
'#exists?'
do
it
'returns true when b
oth branch, and commit exists
'
do
it
'returns true when b
ranch exists and commit is part of the branch
'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
))
expect
(
branch
.
exists?
).
to
eq
true
end
it
'returns false when branch
does not exist
'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'
removed-branch
'
)))
it
'returns false when branch
exists and commit is not part of the branch
'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'
feature
'
)))
expect
(
branch
.
exists?
).
to
eq
false
end
it
'returns false when
commit
does not exist'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
sha:
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b
'
)))
it
'returns false when
branch
does not exist'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'removed-branch
'
)))
expect
(
branch
.
exists?
).
to
eq
false
end
...
...
spec/lib/gitlab/github_import/importer_spec.rb
View file @
ec4b03a4
...
...
@@ -130,7 +130,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
let!
(
:user
)
{
create
(
:user
,
email:
octocat
.
email
)
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:source_sha
)
{
create
(
:commit
,
project:
project
).
id
}
let
(
:source_branch
)
{
double
(
ref:
'
feature
'
,
repo:
repository
,
sha:
source_sha
)
}
let
(
:source_branch
)
{
double
(
ref:
'
branch-merged
'
,
repo:
repository
,
sha:
source_sha
)
}
let
(
:target_sha
)
{
create
(
:commit
,
project:
project
,
git_commit:
RepoHelpers
.
another_sample_commit
).
id
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
repository
,
sha:
target_sha
)
}
let
(
:pull_request
)
do
...
...
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
View file @
ec4b03a4
...
...
@@ -7,7 +7,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
let
(
:target_sha
)
{
create
(
:commit
,
project:
project
,
git_commit:
RepoHelpers
.
another_sample_commit
).
id
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:source_repo
)
{
repository
}
let
(
:source_branch
)
{
double
(
ref:
'
feature
'
,
repo:
source_repo
,
sha:
source_sha
)
}
let
(
:source_branch
)
{
double
(
ref:
'
branch-merged
'
,
repo:
source_repo
,
sha:
source_sha
)
}
let
(
:target_repo
)
{
repository
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
target_repo
,
sha:
target_sha
)
}
let
(
:removed_branch
)
{
double
(
ref:
'removed-branch'
,
repo:
source_repo
,
sha:
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b'
)
}
...
...
@@ -49,7 +49,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_branch:
'master'
,
...
...
@@ -75,7 +75,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_branch:
'master'
,
...
...
@@ -102,7 +102,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_branch:
'master'
,
...
...
@@ -194,7 +194,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns branch ref'
do
expect
(
pull_request
.
source_branch_name
).
to
eq
'
feature
'
expect
(
pull_request
.
source_branch_name
).
to
eq
'
branch-merged
'
end
end
...
...
@@ -208,7 +208,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
shared_examples
'Gitlab::GithubImport::PullRequestFormatter#target_branch_name'
do
context
'when
source
branch exists'
do
context
'when
target
branch exists'
do
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns branch ref'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment