@@ -9,7 +9,7 @@ public struct GitLock
99 {
1010 public static GitLock Default = new GitLock ( ) ;
1111
12- public int id ;
12+ public string id ;
1313 public string path ;
1414 public GitUser owner ;
1515 [ NotSerialized ] public string lockedAtString ;
@@ -21,6 +21,7 @@ public DateTimeOffset locked_at
2121 if ( ! DateTimeOffset . TryParseExact ( lockedAtString , Constants . Iso8601Formats ,
2222 CultureInfo . InvariantCulture , Constants . DateTimeStyle , out dt ) )
2323 {
24+ locked_at = DateTimeOffset . MinValue ;
2425 return DateTimeOffset . MinValue ;
2526 }
2627 return dt ;
@@ -30,15 +31,15 @@ public DateTimeOffset locked_at
3031 lockedAtString = value . ToUniversalTime ( ) . ToString ( Constants . Iso8601FormatZ , CultureInfo . InvariantCulture ) ;
3132 }
3233 }
33- [ NotSerialized ] public int ID => id ;
34- [ NotSerialized ] public NPath Path => path . ToNPath ( ) ;
34+ [ NotSerialized ] public string ID => id ?? String . Empty ;
35+ [ NotSerialized ] public NPath Path => path ? . ToNPath ( ) ?? NPath . Default ;
3536 [ NotSerialized ] public GitUser Owner => owner ;
3637 [ NotSerialized ] public DateTimeOffset LockedAt => locked_at ;
3738
38- public GitLock ( int id , NPath path , GitUser owner , DateTimeOffset locked_at )
39+ public GitLock ( string id , NPath path , GitUser owner , DateTimeOffset locked_at )
3940 {
4041 this . id = id ;
41- this . path = path ;
42+ this . path = path . IsInitialized ? path . ToString ( ) : null ;
4243 this . owner = owner ;
4344 this . lockedAtString = locked_at . ToUniversalTime ( ) . ToString ( Constants . Iso8601FormatZ , CultureInfo . InvariantCulture ) ;
4445 }
@@ -58,7 +59,7 @@ public bool Equals(GitLock other)
5859 public override int GetHashCode ( )
5960 {
6061 int hash = 17 ;
61- hash = hash * 23 + id . GetHashCode ( ) ;
62+ hash = hash * 23 + ID . GetHashCode ( ) ;
6263 hash = hash * 23 + Path . GetHashCode ( ) ;
6364 hash = hash * 23 + owner . GetHashCode ( ) ;
6465 hash = hash * 23 + locked_at . GetHashCode ( ) ;
@@ -67,7 +68,7 @@ public override int GetHashCode()
6768
6869 public static bool operator == ( GitLock lhs , GitLock rhs )
6970 {
70- return lhs . id == rhs . id && lhs . Path == rhs . Path && lhs . owner == rhs . owner && lhs . locked_at == rhs . locked_at ;
71+ return lhs . ID == rhs . ID && lhs . Path == rhs . Path && lhs . owner == rhs . owner && lhs . locked_at == rhs . locked_at ;
7172 }
7273
7374 public static bool operator != ( GitLock lhs , GitLock rhs )
@@ -76,7 +77,7 @@ public override int GetHashCode()
7677 }
7778 public override string ToString ( )
7879 {
79- return $ "{{id: { id } , path:{ Path } , owner:{{{owner}}}, locked_at:'{ locked_at } '}}";
80+ return $ "{{ID: { ID } , path:{ Path } , owner:{{{owner}}}, locked_at:'{ locked_at } '}}";
8081 }
8182 }
8283}
0 commit comments