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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
44484cfc
Commit
44484cfc
authored
Jun 15, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a pre-built commit message for when no user specified message exists
parent
e08ce52a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
+34
-11
app/assets/javascripts/ide/components/commit_sidebar/form.vue
...assets/javascripts/ide/components/commit_sidebar/form.vue
+2
-1
app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
...vascripts/ide/components/commit_sidebar/message_field.vue
+5
-1
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+11
-7
app/assets/javascripts/ide/stores/modules/commit/getters.js
app/assets/javascripts/ide/stores/modules/commit/getters.js
+14
-0
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+2
-2
No files found.
app/assets/javascripts/ide/components/commit_sidebar/form.vue
View file @
44484cfc
...
...
@@ -24,7 +24,7 @@ export default {
...
mapState
([
'
changedFiles
'
,
'
stagedFiles
'
,
'
currentActivityView
'
,
'
lastCommitMsg
'
]),
...
mapState
(
'
commit
'
,
[
'
commitMessage
'
,
'
submitCommitLoading
'
]),
...
mapGetters
([
'
hasChanges
'
]),
...
mapGetters
(
'
commit
'
,
[
'
discardDraftButtonDisabled
'
]),
...
mapGetters
(
'
commit
'
,
[
'
discardDraftButtonDisabled
'
,
'
preBuiltCommitMessage
'
]),
overviewText
()
{
return
sprintf
(
__
(
...
...
@@ -139,6 +139,7 @@ export default {
</transition>
<commit-message-field
:text=
"commitMessage"
:placeholder=
"preBuiltCommitMessage"
@
input=
"updateCommitMessage"
/>
<div
class=
"clearfix prepend-top-15"
>
...
...
app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
View file @
44484cfc
...
...
@@ -16,6 +16,10 @@ export default {
type
:
String
,
required
:
true
,
},
placeholder
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
...
...
@@ -114,7 +118,7 @@ export default {
</div>
<textarea
ref=
"textarea"
:placeholder=
"
__('Write a commit message...')
"
:placeholder=
"
placeholder
"
:value=
"text"
class=
"note-textarea ide-commit-message-textarea"
name=
"commit-message"
...
...
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
44484cfc
...
...
@@ -103,12 +103,6 @@ export const updateFilesAfterCommit = ({ commit, dispatch, rootState }, { data }
export
const
commitChanges
=
({
commit
,
state
,
getters
,
dispatch
,
rootState
,
rootGetters
})
=>
{
const
newBranch
=
state
.
commitAction
!==
consts
.
COMMIT_TO_CURRENT_BRANCH
;
const
payload
=
createCommitPayload
({
branch
:
getters
.
branchName
,
newBranch
,
state
,
rootState
,
});
const
stageFilesPromise
=
rootState
.
stagedFiles
.
length
?
Promise
.
resolve
()
:
dispatch
(
'
stageAllChanges
'
,
null
,
{
root
:
true
});
...
...
@@ -116,7 +110,17 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
commit
(
types
.
UPDATE_LOADING
,
true
);
return
stageFilesPromise
.
then
(()
=>
service
.
commit
(
rootState
.
currentProjectId
,
payload
))
.
then
(()
=>
{
const
payload
=
createCommitPayload
({
branch
:
getters
.
branchName
,
newBranch
,
getters
,
state
,
rootState
,
});
return
service
.
commit
(
rootState
.
currentProjectId
,
payload
);
})
.
then
(({
data
})
=>
{
commit
(
types
.
UPDATE_LOADING
,
false
);
...
...
app/assets/javascripts/ide/stores/modules/commit/getters.js
View file @
44484cfc
import
{
sprintf
,
n__
}
from
'
../../../../locale
'
;
import
*
as
consts
from
'
./constants
'
;
const
BRANCH_SUFFIX_COUNT
=
5
;
...
...
@@ -25,5 +26,18 @@ export const branchName = (state, getters, rootState) => {
return
rootState
.
currentBranchId
;
};
export
const
preBuiltCommitMessage
=
(
state
,
_
,
rootState
)
=>
{
if
(
state
.
commitMessage
)
return
state
.
commitMessage
;
const
files
=
(
rootState
.
stagedFiles
.
length
?
rootState
.
stagedFiles
:
rootState
.
changedFiles
).
reduce
((
acc
,
val
)
=>
acc
.
concat
(
val
.
path
),
[]);
return
sprintf
(
n__
(
'
Update %{files}
'
,
'
Update %{files} files
'
,
files
.
length
),
{
files
:
files
.
join
(
'
,
'
),
});
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
app/assets/javascripts/ide/stores/utils.js
View file @
44484cfc
...
...
@@ -105,9 +105,9 @@ export const setPageTitle = title => {
document
.
title
=
title
;
};
export
const
createCommitPayload
=
({
branch
,
newBranch
,
state
,
rootState
})
=>
({
export
const
createCommitPayload
=
({
branch
,
getters
,
newBranch
,
state
,
rootState
})
=>
({
branch
,
commit_message
:
state
.
commitMessage
,
commit_message
:
state
.
commitMessage
||
getters
.
preBuiltCommitMessage
,
actions
:
rootState
.
stagedFiles
.
map
(
f
=>
({
action
:
f
.
tempFile
?
'
create
'
:
'
update
'
,
file_path
:
f
.
path
,
...
...
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