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
40c97196
Commit
40c97196
authored
Sep 04, 2019
by
Heinrich Lee Yu
Committed by
Mayra Cabrera
Sep 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix syncing of commits to Jira
We were incorrectly calling `hash` instead of `id` to get the commit SHA
parent
d00c78a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
ee/app/services/ee/git/branch_hooks_service.rb
ee/app/services/ee/git/branch_hooks_service.rb
+1
-1
ee/spec/services/ee/git/branch_push_service_spec.rb
ee/spec/services/ee/git/branch_push_service_spec.rb
+10
-1
No files found.
ee/app/services/ee/git/branch_hooks_service.rb
View file @
40c97196
...
...
@@ -14,7 +14,7 @@ module EE
return
unless
jira_subscription_exists?
branch_to_sync
=
branch_name
if
Atlassian
::
JiraIssueKeyExtractor
.
has_keys?
(
branch_name
)
commits_to_sync
=
limited_commits
.
select
{
|
commit
|
Atlassian
::
JiraIssueKeyExtractor
.
has_keys?
(
commit
.
safe_message
)
}.
map
(
&
:
hash
)
commits_to_sync
=
limited_commits
.
select
{
|
commit
|
Atlassian
::
JiraIssueKeyExtractor
.
has_keys?
(
commit
.
safe_message
)
}.
map
(
&
:
sha
)
if
branch_to_sync
||
commits_to_sync
.
any?
JiraConnect
::
SyncBranchWorker
.
perform_async
(
project
.
id
,
branch_to_sync
,
commits_to_sync
)
...
...
ee/spec/services/ee/git/branch_push_service_spec.rb
View file @
40c97196
...
...
@@ -111,10 +111,16 @@ describe Git::BranchPushService do
context
'Jira Connect hooks'
do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:branch_to_sync
)
{
nil
}
let
(
:commits_to_sync
)
{
[]
}
shared_examples
'enqueues Jira sync worker'
do
it
do
Sidekiq
::
Testing
.
fake!
do
expect
(
JiraConnect
::
SyncBranchWorker
).
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
branch_to_sync
,
commits_to_sync
)
.
and_call_original
expect
{
subject
.
execute
}.
to
change
(
JiraConnect
::
SyncBranchWorker
.
jobs
,
:size
).
by
(
1
)
end
end
...
...
@@ -144,12 +150,15 @@ describe Git::BranchPushService do
end
context
'branch name contains Jira issue key'
do
let
(
:ref
)
{
'refs/heads/branch-JIRA-123'
}
let
(
:branch_to_sync
)
{
'branch-JIRA-123'
}
let
(
:ref
)
{
"refs/heads/
#{
branch_to_sync
}
"
}
it_behaves_like
'enqueues Jira sync worker'
end
context
'commit message contains Jira issue key'
do
let
(
:commits_to_sync
)
{
[
newrev
]
}
before
do
allow_any_instance_of
(
Commit
).
to
receive
(
:safe_message
).
and_return
(
'Commit with key JIRA-123'
)
end
...
...
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