@@ -79,7 +79,7 @@ ClassMethod IsUncommitted(Filename, ByRef ID) As %Boolean
7979}
8080
8181/// Goes through Uncommitted queue and removes any items of action 'edit' or 'add' which are ReadOnly or non-existent on the filesystem
82- ClassMethod RefreshUncommitted(Display = 1 , IncludeRevert = 0) As %Status
82+ ClassMethod RefreshUncommitted (Display = 0 , IncludeRevert = 0 ) As %Status
8383{
8484 // files from the uncommitted queue
8585 set sc =..ListUncommitted (.tFileList ,IncludeRevert ,0 )
@@ -88,21 +88,42 @@ ClassMethod RefreshUncommitted(Display = 1, IncludeRevert = 0) As %Status
8888 // files from git status
8989 do ##class (Utils ).GitStatus (.gitFiles )
9090
91+ // Remove entries in the uncommitted queue that don't correspond to changes as tracked by git
9192 set filename =" " , filename =$order (tFileList (filename ),1 ,action )
92- while (filename'="") {
93- set examine=$select(action="add":1,action="edit":1,IncludeRevert&&(action="revert"):1,1:0)
93+ while (filename '=" " ) {
94+ set examine =$select (action =" add" :1 ,action =" edit" :1 ,action = " delete " : 1 , IncludeRevert &&(action =" revert" ):1 ,1 :0 )
9495 if 'examine set filename =$order (tFileList (filename ),1 ,action ) continue
9596
9697 set InternalName = ##class (SourceControl.Git.Utils ).NameToInternalName (filename ,0 ,0 )
9798
98- if (('##class(%File).Exists(filename)) || ((InternalName '= "") && ('$data(gitFiles(InternalName), found)) && ($data($$$TrackedItems(InternalName))))) {
99+ if (('##class (%File ).Exists (filename )) || (InternalName = " " ) || ((InternalName '= " " ) && ('$data (gitFiles (InternalName ), found )) &&
100+ (($data ($$$TrackedItems(InternalName ))) || ##class (SourceControl.Git.Utils ).NormalizeExtension ($data ($$$TrackedItems(InternalName )))))) {
99101 set sc =..RemoveUncommitted (filename ,Display ,0 ,0 )
100102 if $$$ISERR(sc ) set filename =" " continue
101103 }
102104 set filename =$order (tFileList (filename ),1 ,action )
103105 }
106+
107+ // Add missing records to the uncommitted queue that correspond to changes as tracked by git
108+ set filename =" " , filename =$order (gitFiles (filename ),1 ,details )
109+ while (filename '=" " ) {
110+ set InternalName = filename
111+ set ExternalName = ##class (%File ).NormalizeFilename (##class (SourceControl.Git.Utils ).TempFolder ()_$list (details ,2 ))
112+ set changeType = $list (details ,1 )
113+
114+ set action = $select (changeType =" A" :" add" ,
115+ changeType =" M" :" edit" ,
116+ changeType =" D" :" delete" ,
117+ changeType =" U" :" add" ,
118+ 1 :" add" )
119+
120+ if ((##class (%File ).Exists (ExternalName )) && ('$ISVALIDNUM (InternalName )) && ('..IsUncommitted (ExternalName )) && ($data ($$$TrackedItems(InternalName )))) {
121+ set sc =..SetUncommitted (ExternalName , action , InternalName , $USERNAME , " " , 1 , " " , " " , 0 )
122+ if $$$ISERR(sc ) w sc set filename =" " continue
123+ }
124+ set filename =$order (gitFiles (filename ),1 ,details )
125+ }
104126 quit sc
105127}
106128
107129}
108-
0 commit comments