This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-19
lines changed
UnityExtension/Assets/Editor/GitHub.Unity Expand file tree Collapse file tree 3 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,11 @@ public ConfigBranch(string name, ConfigRemote? remote)
5050 this . remote = remote ?? ConfigRemote . Default ;
5151 }
5252
53- public bool IsTracking => ! remote . Equals ( ConfigRemote . Default ) ;
53+ public bool IsTracking => Remote . HasValue ;
5454
5555 public string Name => name ;
5656
57- public ConfigRemote ? Remote => remote ;
57+ public ConfigRemote ? Remote => Equals ( remote , ConfigRemote . Default ) ? ( ConfigRemote ? ) null : remote ;
5858
5959 public override string ToString ( )
6060 {
Original file line number Diff line number Diff line change @@ -646,6 +646,7 @@ public void Initialize(IGitClient client)
646646 Logger . Trace ( "Initialize" ) ;
647647
648648 gitClient = client ;
649+ cacheContainer . GitUserCache . ValidateData ( ) ;
649650 }
650651
651652 public void SetNameAndEmail ( string name , string email )
@@ -699,20 +700,23 @@ private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
699700
700701 private void UpdateUserAndEmail ( )
701702 {
702- if ( gitClient != null )
703- {
704- Logger . Trace ( "UpdateUserAndEmail" ) ;
703+ Logger . Trace ( "UpdateUserAndEmail" ) ;
705704
706- gitClient . GetConfigUserAndEmail ( )
707- . ThenInUI ( ( success , value ) =>
708- {
709- if ( success )
710- {
711- Name = value . Name ;
712- Email = value . Email ;
713- }
714- } ) . Start ( ) ;
705+ if ( gitClient == null )
706+ {
707+ Logger . Trace ( "GitClient is null" ) ;
708+ return ;
715709 }
710+
711+ gitClient . GetConfigUserAndEmail ( )
712+ . ThenInUI ( ( success , value ) =>
713+ {
714+ if ( success )
715+ {
716+ Name = value . Name ;
717+ Email = value . Email ;
718+ }
719+ } ) . Start ( ) ;
716720 }
717721
718722 protected static ILogging Logger { get ; } = Logging . GetLogger < User > ( ) ;
Original file line number Diff line number Diff line change @@ -148,13 +148,10 @@ private bool ValidateInitialized()
148148 var notInitialized = ApplicationCache . Instance . FirstRunAt > InitializedAt ;
149149 if ( notInitialized )
150150 {
151- Logger . Trace ( "Initialized" ) ;
152- InitializedAt = DateTimeOffset . Now ;
153- Save ( true ) ;
151+ Logger . Trace ( "Not Initialized" ) ;
154152
155153 if ( invalidOnFirstRun )
156154 {
157- Logger . Trace ( "FirstRun Invalidation" ) ;
158155 InvalidateData ( ) ;
159156 }
160157 }
@@ -166,11 +163,15 @@ public void InvalidateData()
166163 {
167164 Logger . Trace ( "Invalidate" ) ;
168165 CacheInvalidated . SafeInvoke ( ) ;
169- SaveData ( DateTimeOffset . Now , false ) ;
170166 }
171167
172168 protected void SaveData ( DateTimeOffset now , bool isUpdated )
173169 {
170+ if ( InitializedAt == DateTimeOffset . MinValue )
171+ {
172+ InitializedAt = now ;
173+ }
174+
174175 if ( isUpdated )
175176 {
176177 LastUpdatedAt = now ;
You can’t perform that action at this time.
0 commit comments