@@ -253,9 +253,15 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
253
253
set Action = 7
254
254
quit $$$OK
255
255
} elseif (menuItemName = " Sync" ) {
256
- set Target = " Enter a commit message for the sync operation"
257
- set Action = 7
258
- set Msg = ..PreSync ()
256
+ if ..CheckForUncommittedFiles () {
257
+ set Target = " Enter a commit message for the sync operation"
258
+ set Action = 7
259
+ set Msg = ..PreSync ()
260
+ } else {
261
+ do ..Sync (" " )
262
+ }
263
+
264
+
259
265
quit $$$OK
260
266
} elseif (menuItemName = " Push" ) {
261
267
quit ..Push ()
@@ -379,17 +385,32 @@ ClassMethod PreSync() As %String
379
385
/// Commits all the files as needed by the Sync operation
380
386
ClassMethod SyncCommit (Msg As %String ) As %Status
381
387
{
382
- set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
383
- set username = ..GitUserName ()
384
- set email = ..GitUserEmail ()
385
- set author = username _" <" _email _" >"
386
- do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Msg )
387
- do ..PrintStreams (errStream , outStream )
388
- $$$QuitOnError(..ClearUncommitted (uncommittedFilesWithAction ))
389
- $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
388
+
389
+ if ..CheckForUncommittedFiles () {
390
+ set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
391
+ set username = ..GitUserName ()
392
+ set email = ..GitUserEmail ()
393
+ set author = username _" <" _email _" >"
394
+ do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Msg )
395
+ do ..PrintStreams (errStream , outStream )
396
+ $$$QuitOnError(..ClearUncommitted (uncommittedFilesWithAction ))
397
+ $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
398
+ }
399
+
390
400
quit $$$OK
391
401
}
392
402
403
+ ClassMethod CheckForUncommittedFiles () As %Boolean
404
+ {
405
+ set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
406
+ set valInArr = uncommittedFilesWithAction .%Pop ()
407
+ if valInArr = " " {
408
+ return 0
409
+ } else {
410
+ quit 1
411
+ }
412
+ }
413
+
393
414
/// Goes through all the added files and stages them
394
415
ClassMethod StageAddedFiles ()
395
416
{
0 commit comments