@@ -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 ()
@@ -376,17 +382,32 @@ ClassMethod PreSync() As %String
376
382
/// Commits all the files as needed by the Sync operation
377
383
ClassMethod SyncCommit (Msg As %String ) As %Status
378
384
{
379
- set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
380
- set username = ..GitUserName ()
381
- set email = ..GitUserEmail ()
382
- set author = username _" <" _email _" >"
383
- do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Msg )
384
- do ..PrintStreams (errStream , outStream )
385
- $$$QuitOnError(..ClearUncommitted (uncommittedFilesWithAction ))
386
- $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
385
+
386
+ if ..CheckForUncommittedFiles () {
387
+ set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
388
+ set username = ..GitUserName ()
389
+ set email = ..GitUserEmail ()
390
+ set author = username _" <" _email _" >"
391
+ do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Msg )
392
+ do ..PrintStreams (errStream , outStream )
393
+ $$$QuitOnError(..ClearUncommitted (uncommittedFilesWithAction ))
394
+ $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
395
+ }
396
+
387
397
quit $$$OK
388
398
}
389
399
400
+ ClassMethod CheckForUncommittedFiles () As %Boolean
401
+ {
402
+ set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
403
+ set valInArr = uncommittedFilesWithAction .%Pop ()
404
+ if valInArr = " " {
405
+ return 0
406
+ } else {
407
+ quit 1
408
+ }
409
+ }
410
+
390
411
/// Goes through all the added files and stages them
391
412
ClassMethod StageAddedFiles ()
392
413
{
0 commit comments