@@ -46,7 +46,6 @@ const getGitStatus = async (repoPath) => {
46
46
} )
47
47
. catch ( ( err ) => {
48
48
console . log ( "Not a git repo or a new git repo with no commits!" ) ;
49
- // console.log(err);
50
49
isGitLogAvailable = false ;
51
50
return isGitLogAvailable ;
52
51
} ) ;
@@ -60,6 +59,7 @@ const getGitStatus = async (repoPath) => {
60
59
( await execPromised ( `git remote` , {
61
60
cwd : repoPath ,
62
61
windowsHide : true ,
62
+ maxBuffer : 1024 * 10240 ,
63
63
} ) . then ( ( { stdout, stderr } ) => {
64
64
if ( stdout && ! stderr ) {
65
65
const localRemote = stdout . trim ( ) . split ( "\n" ) ;
@@ -73,7 +73,6 @@ const getGitStatus = async (repoPath) => {
73
73
windowsHide : true ,
74
74
} ) . then ( ( { stdout, stderr } ) => {
75
75
if ( stdout && ! stderr ) {
76
- console . log ( "REMOTE :: " , stdout ) ;
77
76
return stdout . trim ( ) ;
78
77
} else {
79
78
console . log ( stderr ) ;
@@ -117,6 +116,7 @@ const getGitStatus = async (repoPath) => {
117
116
( await execPromised ( `git branch --all` , {
118
117
cwd : repoPath ,
119
118
windowsHide : true ,
119
+ maxBuffer : 1024 * 10240 ,
120
120
} )
121
121
. then ( ( res ) => {
122
122
const { stdout, stderr } = res ;
@@ -139,7 +139,11 @@ const getGitStatus = async (repoPath) => {
139
139
// Module to get all available branches
140
140
gitBranchList =
141
141
isGitLogAvailable &&
142
- ( await execPromised ( `git branch` , { cwd : repoPath , windowsHide : true } )
142
+ ( await execPromised ( `git branch` , {
143
+ cwd : repoPath ,
144
+ windowsHide : true ,
145
+ maxBuffer : 1024 * 10240 ,
146
+ } )
143
147
. then ( ( res ) => {
144
148
if ( ! res . stderr ) {
145
149
return res . stdout ;
@@ -186,28 +190,35 @@ const getGitStatus = async (repoPath) => {
186
190
( await execPromised ( `git log --oneline` , {
187
191
cwd : repoPath ,
188
192
windowsHide : true ,
193
+ maxBuffer : 1024 * 10240 ,
189
194
} )
190
195
. then ( ( res ) => {
191
196
const { stdout, stderr } = res ;
192
- if ( stderr ) {
193
- console . log ( stderr ) ;
194
- }
195
- if ( res && ! res . stderr ) {
196
- const gitLocalTotal = res . stdout . trim ( ) . split ( "\n" ) ;
197
+ if ( stdout && ! stderr ) {
198
+ const gitLocalTotal = stdout . trim ( ) . split ( "\n" ) ;
199
+ console . log ( "Total commits: " , gitLocalTotal . length ) ;
197
200
if ( gitLocalTotal && gitLocalTotal . length > 0 ) {
198
201
gitTotalCommits = gitLocalTotal . length ;
199
202
} else if ( gitLocalTotal . length === 1 ) {
200
203
gitTotalCommits = 1 ;
201
204
}
202
205
} else {
203
- gitTotalCommits = 0 ;
204
- console . log ( stderr ) ;
206
+ if ( ! gitTotalCommits ) {
207
+ gitTotalCommits = 0 ;
208
+ }
209
+ console . log (
210
+ "ERROR: Error occurred while collcting all commits" ,
211
+ stderr
212
+ ) ;
205
213
}
206
214
return gitTotalCommits ;
207
215
} )
208
216
. catch ( ( err ) => {
209
- gitTotalCommits = 0 ;
210
- console . log ( err ) ;
217
+ if ( ! gitTotalCommits ) {
218
+ gitTotalCommits = 0 ;
219
+ }
220
+ console . log ( typeof err ) ;
221
+ console . log ( "ERROR: Error occurred while collcting all commits" ) ;
211
222
} ) ) ;
212
223
213
224
//Module to get latest git commit
@@ -238,6 +249,7 @@ const getGitStatus = async (repoPath) => {
238
249
( await execPromised ( `git ls-tree --name-status HEAD` , {
239
250
cwd : repoPath ,
240
251
windowsHide : true ,
252
+ maxBuffer : 1024 * 10240 ,
241
253
} )
242
254
. then ( ( { stdout, stderr } ) => {
243
255
if ( stdout && ! stderr ) {
@@ -307,6 +319,7 @@ const getGitStatus = async (repoPath) => {
307
319
( await execPromised ( `git ls-files` , {
308
320
cwd : repoPath ,
309
321
windowsHide : true ,
322
+ maxBuffer : 1024 * 10240 ,
310
323
} ) . then ( ( res ) => {
311
324
const { stdout, stderr } = res ;
312
325
if ( stdout && ! stderr ) {
0 commit comments