Пример #1
0
 private static string ParseReference(LibGit2Sharp.Repository repo, string treeish, ILogger log)
 {
     LibGit2Sharp.Reference reference = null;
     LibGit2Sharp.GitObject dummy;
     try
     {
         repo.RevParse(treeish, out reference, out dummy);
     }
     catch
     {
         // nothing we can do
     }
     log.LogDebug($"Parsed {treeish} to mean {reference?.TargetIdentifier ?? "<invalid>"}");
     if (reference == null)
     {
         try
         {
             repo.RevParse($"origin/{treeish}", out reference, out dummy);
         }
         catch
         {
             // nothing we can do
         }
         log.LogDebug($"Parsed origin/{treeish} to mean {reference?.TargetIdentifier ?? "<invalid>"}");
     }
     return(reference?.TargetIdentifier);
 }