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
...
@@ -18,7 +18,7 @@ module Gitlab
end
end
def
commit_exists?
def
commit_exists?
project
.
repository
.
commit
(
sha
).
present?
project
.
repository
.
branch_names_contains
(
sha
).
include?
(
ref
)
end
end
def
short_id
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
...
@@ -6,27 +6,27 @@ describe Gitlab::GithubImport::BranchFormatter, lib: true do
let
(
:repo
)
{
double
}
let
(
:repo
)
{
double
}
let
(
:raw
)
do
let
(
:raw
)
do
{
{
ref:
'
feature
'
,
ref:
'
branch-merged
'
,
repo:
repo
,
repo:
repo
,
sha:
commit
.
id
sha:
commit
.
id
}
}
end
end
describe
'#exists?'
do
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
))
branch
=
described_class
.
new
(
project
,
double
(
raw
))
expect
(
branch
.
exists?
).
to
eq
true
expect
(
branch
.
exists?
).
to
eq
true
end
end
it
'returns false when branch
does not exist
'
do
it
'returns false when branch
exists and commit is not part of the branch
'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'
removed-branch
'
)))
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'
feature
'
)))
expect
(
branch
.
exists?
).
to
eq
false
expect
(
branch
.
exists?
).
to
eq
false
end
end
it
'returns false when
commit
does not exist'
do
it
'returns false when
branch
does not exist'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
sha:
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b
'
)))
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
ref:
'removed-branch
'
)))
expect
(
branch
.
exists?
).
to
eq
false
expect
(
branch
.
exists?
).
to
eq
false
end
end
...
...
spec/lib/gitlab/github_import/importer_spec.rb
View file @
ec4b03a4
...
@@ -130,7 +130,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
...
@@ -130,7 +130,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
let!
(
:user
)
{
create
(
:user
,
email:
octocat
.
email
)
}
let!
(
:user
)
{
create
(
:user
,
email:
octocat
.
email
)
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:source_sha
)
{
create
(
:commit
,
project:
project
).
id
}
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_sha
)
{
create
(
:commit
,
project:
project
,
git_commit:
RepoHelpers
.
another_sample_commit
).
id
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
repository
,
sha:
target_sha
)
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
repository
,
sha:
target_sha
)
}
let
(
:pull_request
)
do
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
...
@@ -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
(
:target_sha
)
{
create
(
:commit
,
project:
project
,
git_commit:
RepoHelpers
.
another_sample_commit
).
id
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
let
(
:source_repo
)
{
repository
}
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_repo
)
{
repository
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
target_repo
,
sha:
target_sha
)
}
let
(
:target_branch
)
{
double
(
ref:
'master'
,
repo:
target_repo
,
sha:
target_sha
)
}
let
(
:removed_branch
)
{
double
(
ref:
'removed-branch'
,
repo:
source_repo
,
sha:
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b'
)
}
let
(
:removed_branch
)
{
double
(
ref:
'removed-branch'
,
repo:
source_repo
,
sha:
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b'
)
}
...
@@ -49,7 +49,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -49,7 +49,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_project:
project
,
target_branch:
'master'
,
target_branch:
'master'
,
...
@@ -75,7 +75,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -75,7 +75,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_project:
project
,
target_branch:
'master'
,
target_branch:
'master'
,
...
@@ -102,7 +102,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -102,7 +102,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
title:
'New feature'
,
title:
'New feature'
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
description:
"*Created by: octocat*
\n\n
Please pull these awesome changes"
,
source_project:
project
,
source_project:
project
,
source_branch:
'
feature
'
,
source_branch:
'
branch-merged
'
,
source_branch_sha:
source_sha
,
source_branch_sha:
source_sha
,
target_project:
project
,
target_project:
project
,
target_branch:
'master'
,
target_branch:
'master'
,
...
@@ -194,7 +194,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -194,7 +194,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
let
(
:raw_data
)
{
double
(
base_data
)
}
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns branch ref'
do
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
end
end
...
@@ -208,7 +208,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -208,7 +208,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
end
shared_examples
'Gitlab::GithubImport::PullRequestFormatter#target_branch_name'
do
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
)
}
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns branch ref'
do
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