2
2
using System . Diagnostics ;
3
3
using System . Globalization ;
4
4
using LibGit2Sharp . Core ;
5
+ using LibGit2Sharp . Core . Compat ;
5
6
6
7
namespace LibGit2Sharp
7
8
{
@@ -18,6 +19,7 @@ public class Submodule : IEquatable<Submodule>
18
19
private readonly string name ;
19
20
private readonly string path ;
20
21
private readonly string url ;
22
+ private readonly Lazy < GitLink > gitLink ;
21
23
private readonly ILazy < ObjectId > headCommitId ;
22
24
private readonly ILazy < ObjectId > indexCommitId ;
23
25
private readonly ILazy < ObjectId > workdirCommitId ;
@@ -38,6 +40,8 @@ internal Submodule(Repository repo, string name, string path, string url)
38
40
this . path = path ;
39
41
this . url = url ;
40
42
43
+ gitLink = new Lazy < GitLink > ( ( ) => new GitLink ( repo , HeadCommitId ) ) ;
44
+
41
45
var commitIds = new SubmoduleLazyGroup ( repo , name ) ;
42
46
headCommitId = commitIds . AddLazy ( Proxy . git_submodule_head_id ) ;
43
47
indexCommitId = commitIds . AddLazy ( Proxy . git_submodule_index_id ) ;
@@ -64,6 +68,11 @@ internal Submodule(Repository repo, string name, string path, string url)
64
68
/// </summary>
65
69
public virtual string Url { get { return url ; } }
66
70
71
+ /// <summary>
72
+ /// The gitlink representing this submodule in the current HEAD tree.
73
+ /// </summary>
74
+ public virtual GitLink GitLink { get { return gitLink . Value ; } }
75
+
67
76
/// <summary>
68
77
/// The commit ID for this submodule in the current HEAD tree.
69
78
/// </summary>
0 commit comments