1- /* @flow weak */
21import { request } from '../utils'
32import config from '../config'
43
@@ -18,16 +17,16 @@ export function gitCheckout (branch, remoteBranch) {
1817 } )
1918}
2019
21- export function gitCommit ( { files, message} ) {
22- return request . post ( `/git/${ config . spaceKey } /commits` , { files, message} )
20+ export function gitCommit ( { files, message } ) {
21+ return request . post ( `/git/${ config . spaceKey } /commits` , { files, message } )
2322}
2423
2524export function gitPull ( ) {
2625 return request . post ( `/git/${ config . spaceKey } /pull` )
2726}
2827
2928export function gitPushAll ( ) {
30- return request . post ( `/git/${ config . spaceKey } /push?all=true` ) . then ( res => {
29+ return request . post ( `/git/${ config . spaceKey } /push?all=true` ) . then ( ( res ) => {
3130 if ( res . ok || res . nothingToPush ) return true
3231 if ( ! res . ok ) return false
3332 } )
@@ -37,73 +36,73 @@ export function gitFetch () {
3736}
3837// branches
3938export function gitNewBranch ( branchName ) {
40- return request . post ( `/git/${ config . spaceKey } /branches` , { branchName} )
39+ return request . post ( `/git/${ config . spaceKey } /branches` , { branchName } )
4140}
4241export function gitGetBranches ( ) {
4342 return request . get ( `/git/${ config . spaceKey } /branches` )
4443}
4544
46- export function gitCurrentBranch ( ) {
45+ export function gitCurrentBranch ( ) {
4746 return request . get ( `/git/${ config . spaceKey } /branch` )
4847}
4948export function gitDeleteBranch ( branchName ) {
50- return request . delete ( `/git/${ config . spaceKey } /branches/` , { branchName} )
49+ return request . delete ( `/git/${ config . spaceKey } /branches/` , { branchName } )
5150}
5251
53- export function gitCreateStash ( message ) {
54- return request . post ( `/git/${ config . spaceKey } /stash` , { message : message } )
52+ export function gitCreateStash ( message ) {
53+ return request . post ( `/git/${ config . spaceKey } /stash` , { message } )
5554}
5655
57- export function gitStashList ( ) {
56+ export function gitStashList ( ) {
5857 return request . get ( `/git/${ config . spaceKey } /stash` )
5958}
6059
61- export function gitDropStash ( stashRef , all = false ) {
62- return request . delete ( `/git/${ config . spaceKey } /stash` , { stashRef, all} )
60+ export function gitDropStash ( stashRef , all = false ) {
61+ return request . delete ( `/git/${ config . spaceKey } /stash` , { stashRef, all } )
6362}
6463
65- export function gitApplyStash ( { stashRef, pop, applyIndex} ) {
66- return request . post ( `/git/${ config . spaceKey } /stash/apply` , { stashRef, pop, applyIndex} )
64+ export function gitApplyStash ( { stashRef, pop, applyIndex } ) {
65+ return request . post ( `/git/${ config . spaceKey } /stash/apply` , { stashRef, pop, applyIndex } )
6766}
6867
69- export function gitCheckoutStash ( { stashRef, branch} ) {
70- return request . post ( `/git/${ config . spaceKey } /stash/checkout` , { stashRef, branch} )
68+ export function gitCheckoutStash ( { stashRef, branch } ) {
69+ return request . post ( `/git/${ config . spaceKey } /stash/checkout` , { stashRef, branch } )
7170}
7271
73- export function gitResetHead ( { ref, resetType} ) {
74- return request . post ( `/git/${ config . spaceKey } /reset` , { ref, resetType} )
72+ export function gitResetHead ( { ref, resetType } ) {
73+ return request . post ( `/git/${ config . spaceKey } /reset` , { ref, resetType } )
7574}
7675
77- export function gitConflicts ( { path} ) {
78- return request . get ( `/git/${ config . spaceKey } /conflicts` , { path, base64 :false } )
76+ export function gitConflicts ( { path } ) {
77+ return request . get ( `/git/${ config . spaceKey } /conflicts` , { path, base64 : false } )
7978}
8079
81- export function gitResolveConflict ( { path, content} ) {
82- return request . post ( `/git/${ config . spaceKey } /conflicts` , { path, content, base64 :false } )
80+ export function gitResolveConflict ( { path, content } ) {
81+ return request . post ( `/git/${ config . spaceKey } /conflicts` , { path, content, base64 : false } )
8382}
8483
85- export function gitCancelConflict ( { path} ) {
86- return request . delete ( `/git/${ config . spaceKey } /conflicts` , { path} )
84+ export function gitCancelConflict ( { path } ) {
85+ return request . delete ( `/git/${ config . spaceKey } /conflicts` , { path } )
8786}
8887
89- export function gitRebase ( { branch, upstream, interactive, preserve} ) {
90- return request . post ( `/git/${ config . spaceKey } /rebase` , { branch, upstream, interactive, preserve} )
88+ export function gitRebase ( { branch, upstream, interactive, preserve } ) {
89+ return request . post ( `/git/${ config . spaceKey } /rebase` , { branch, upstream, interactive, preserve } )
9190}
9291
93- export function gitAddTag ( { tagName, ref, message, force} ) {
94- return request . post ( `/git/${ config . spaceKey } /tags` , { tagName, ref, message, force} )
92+ export function gitAddTag ( { tagName, ref, message, force } ) {
93+ return request . post ( `/git/${ config . spaceKey } /tags` , { tagName, ref, message, force } )
9594}
9695
9796export function gitMerge ( branch ) {
98- return request . post ( `/git/${ config . spaceKey } /merge` , { name : branch } )
97+ return request . post ( `/git/${ config . spaceKey } /merge` , { name : branch } )
9998}
10099
101100export function gitRebaseState ( ) {
102101 return request . get ( `/git/${ config . spaceKey } ?state` )
103102}
104103
105- export function gitRebaseOperate ( { operation, message} ) {
106- return request . post ( `/git/${ config . spaceKey } /rebase/operate` , { operation, message} )
104+ export function gitRebaseOperate ( { operation, message } ) {
105+ return request . post ( `/git/${ config . spaceKey } /rebase/operate` , { operation, message } )
107106}
108107
109108export function gitRebaseUpdate ( lines ) {
@@ -112,15 +111,15 @@ export function gitRebaseUpdate (lines) {
112111 )
113112}
114113
115- export function gitCommitDiff ( { rev} ) {
114+ export function gitCommitDiff ( { rev } ) {
116115 return request . diffFilesList ( `/git/${ config . spaceKey } /commits` , { ref : rev } )
117116}
118117
119118export function gitFileDiff ( { path, oldRef, newRef } ) {
120119 return request . diff ( `/git/${ config . spaceKey } /commits` , { path, oldRef, newRef } )
121120}
122121
123- export function gitReadFile ( { ref, path} ) {
122+ export function gitReadFile ( { ref, path } ) {
124123 return request . get ( `/git/${ config . spaceKey } /read` , { path, ref, base64 : false } )
125124}
126125
@@ -132,17 +131,15 @@ export function gitBlame (path) {
132131 return request . get ( `/git/${ config . spaceKey } /blame` , { path } )
133132}
134133
135- export function gitLogs ( params = { } ) {
134+ export function gitLogs ( params = { } ) {
136135 return request . get ( `/git/${ config . spaceKey } /logs` , params )
137- . then ( commits => commits . map ( c => {
138- return {
139- id : c . name ,
140- author : c . authorIdent ,
141- parentIds : c . parents ,
142- message : c . shortMessage ,
143- date : new Date ( c . commitTime * 1000 ) ,
144- }
145- } ) )
136+ . then ( commits => commits . map ( c => ( {
137+ id : c . name ,
138+ author : c . authorIdent ,
139+ parentIds : c . parents ,
140+ message : c . shortMessage ,
141+ date : new Date ( c . commitTime * 1000 ) ,
142+ } ) ) )
146143}
147144
148145export function gitRefs ( ) {
0 commit comments