private static IEnumerable <string> findTargetBranch(string path, string remoteSourceBranch) { for (int iDepth = 0; iDepth < Constants.MaxCommitDepth; ++iDepth) { string sha = String.Format("{0}{1}", remoteSourceBranch, new string('^', iDepth)); IEnumerable <string> refs = GitTools.GetRemotePointsAt(path, sha) .Where(x => x != remoteSourceBranch) .Where(x => x != String.Format("{0}HEAD", RemoteOrigin)); if (refs.Any()) { return(refs); } } return(new string[] { String.Format("{0}master", RemoteOrigin) }); }
private static string getRemoteSourceBranch(string path, string sourceBranch) { IEnumerable <string> refs = GitTools.GetRemotePointsAt(path, sourceBranch); return(refs != null?refs.FirstOrDefault() : null); }