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
7a57e59e
Commit
7a57e59e
authored
Aug 30, 2018
by
Takuya Noguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sample data for push event when no commits created
parent
3a0f3082
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
changelogs/unreleased/50564-chat-service-refactoring.yml
changelogs/unreleased/50564-chat-service-refactoring.yml
+5
-0
lib/gitlab/data_builder/push.rb
lib/gitlab/data_builder/push.rb
+6
-2
No files found.
changelogs/unreleased/50564-chat-service-refactoring.yml
0 → 100644
View file @
7a57e59e
---
title
:
Use sample data for push event when no commits created
merge_request
:
21440
author
:
Takuya Noguchi
type
:
fixed
lib/gitlab/data_builder/push.rb
View file @
7a57e59e
...
...
@@ -97,11 +97,15 @@ module Gitlab
}
end
# This method provide a sample data generated with
# This method provide
s
a sample data generated with
# existing project and commits to test webhooks
def
build_sample
(
project
,
user
)
# Use sample data if repo has no commit
# (expect the case of test service configuration settings)
return
sample_data
if
project
.
empty_repo?
ref
=
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
project
.
default_branch
}
"
commits
=
project
.
repository
.
commits
(
project
.
default_branch
.
to_s
,
limit:
3
)
rescue
[]
commits
=
project
.
repository
.
commits
(
project
.
default_branch
.
to_s
,
limit:
3
)
build
(
project
,
user
,
commits
.
last
&
.
id
,
commits
.
first
&
.
id
,
ref
,
commits
)
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