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
0a1f0bfc
Commit
0a1f0bfc
authored
Mar 03, 2021
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve project from branch repository
parent
e367975a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
3 deletions
+7
-3
app/graphql/mutations/branches/create.rb
app/graphql/mutations/branches/create.rb
+0
-2
app/graphql/resolvers/branch_commit_resolver.rb
app/graphql/resolvers/branch_commit_resolver.rb
+2
-1
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-0
spec/graphql/resolvers/branch_commit_resolver_spec.rb
spec/graphql/resolvers/branch_commit_resolver_spec.rb
+4
-0
No files found.
app/graphql/mutations/branches/create.rb
View file @
0a1f0bfc
...
...
@@ -30,8 +30,6 @@ module Mutations
def
resolve
(
project_path
:,
name
:,
ref
:)
project
=
authorized_find!
(
project_path
)
context
.
scoped_set!
(
:branch_project
,
project
)
result
=
::
Branches
::
CreateService
.
new
(
project
,
current_user
)
.
execute
(
name
,
ref
)
...
...
app/graphql/resolvers/branch_commit_resolver.rb
View file @
0a1f0bfc
...
...
@@ -10,8 +10,9 @@ module Resolvers
return
unless
branch
commit
=
branch
.
dereferenced_target
project
=
Project
.
find_by_full_path
(
commit
.
repository
.
gl_project_path
)
::
Commit
.
new
(
commit
,
context
[
:branch_project
]
)
if
commit
::
Commit
.
new
(
commit
,
project
)
if
commit
end
end
end
lib/gitlab/git/commit.rb
View file @
0a1f0bfc
...
...
@@ -20,6 +20,7 @@ module Gitlab
].
freeze
attr_accessor
(
*
SERIALIZE_KEYS
)
attr_reader
:repository
def
==
(
other
)
return
false
unless
other
.
is_a?
(
Gitlab
::
Git
::
Commit
)
...
...
spec/graphql/resolvers/branch_commit_resolver_spec.rb
View file @
0a1f0bfc
...
...
@@ -15,6 +15,10 @@ RSpec.describe Resolvers::BranchCommitResolver do
is_expected
.
to
eq
(
repository
.
commits
(
'master'
,
limit:
1
).
last
)
end
it
'sets project container'
do
expect
(
commit
.
container
).
to
eq
(
repository
.
project
)
end
context
'when branch does not exist'
do
let
(
:branch
)
{
nil
}
...
...
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