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)
50
50
this . remote = remote ?? ConfigRemote . Default ;
51
51
}
52
52
53
- public bool IsTracking => ! remote . Equals ( ConfigRemote . Default ) ;
53
+ public bool IsTracking => Remote . HasValue ;
54
54
55
55
public string Name => name ;
56
56
57
- public ConfigRemote ? Remote => remote ;
57
+ public ConfigRemote ? Remote => Equals ( remote , ConfigRemote . Default ) ? ( ConfigRemote ? ) null : remote ;
58
58
59
59
public override string ToString ( )
60
60
{
Original file line number Diff line number Diff line change @@ -646,6 +646,7 @@ public void Initialize(IGitClient client)
646
646
Logger . Trace ( "Initialize" ) ;
647
647
648
648
gitClient = client ;
649
+ cacheContainer . GitUserCache . ValidateData ( ) ;
649
650
}
650
651
651
652
public void SetNameAndEmail ( string name , string email )
@@ -699,20 +700,23 @@ private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
699
700
700
701
private void UpdateUserAndEmail ( )
701
702
{
702
- if ( gitClient != null )
703
- {
704
- Logger . Trace ( "UpdateUserAndEmail" ) ;
703
+ Logger . Trace ( "UpdateUserAndEmail" ) ;
705
704
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 ;
715
709
}
710
+
711
+ gitClient . GetConfigUserAndEmail ( )
712
+ . ThenInUI ( ( success , value ) =>
713
+ {
714
+ if ( success )
715
+ {
716
+ Name = value . Name ;
717
+ Email = value . Email ;
718
+ }
719
+ } ) . Start ( ) ;
716
720
}
717
721
718
722
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()
148
148
var notInitialized = ApplicationCache . Instance . FirstRunAt > InitializedAt ;
149
149
if ( notInitialized )
150
150
{
151
- Logger . Trace ( "Initialized" ) ;
152
- InitializedAt = DateTimeOffset . Now ;
153
- Save ( true ) ;
151
+ Logger . Trace ( "Not Initialized" ) ;
154
152
155
153
if ( invalidOnFirstRun )
156
154
{
157
- Logger . Trace ( "FirstRun Invalidation" ) ;
158
155
InvalidateData ( ) ;
159
156
}
160
157
}
@@ -166,11 +163,15 @@ public void InvalidateData()
166
163
{
167
164
Logger . Trace ( "Invalidate" ) ;
168
165
CacheInvalidated . SafeInvoke ( ) ;
169
- SaveData ( DateTimeOffset . Now , false ) ;
170
166
}
171
167
172
168
protected void SaveData ( DateTimeOffset now , bool isUpdated )
173
169
{
170
+ if ( InitializedAt == DateTimeOffset . MinValue )
171
+ {
172
+ InitializedAt = now ;
173
+ }
174
+
174
175
if ( isUpdated )
175
176
{
176
177
LastUpdatedAt = now ;
You can’t perform that action at this time.
0 commit comments