public static string GetSubmoduleText(GitModule superproject, string name, string hash)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Submodule " + name);
            sb.AppendLine();
            GitModule module = superproject.GetSubmodule(name);

            if (module.IsValidGitWorkingDir())
            {
                string     error = "";
                CommitData data  = CommitData.GetCommitData(module, hash, ref error);
                if (data == null)
                {
                    sb.AppendLine("Commit hash:\t" + hash);
                    return(sb.ToString());
                }

                string header = data.GetHeaderPlain();
                string body   = "\n" + data.Body.Trim();
                sb.AppendLine(header);
                sb.Append(body);
            }
            else
            {
                sb.AppendLine("Commit hash:\t" + hash);
            }
            return(sb.ToString());
        }
示例#2
0
        public static string GetSubmoduleText(GitModule superproject, string name, string hash)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Submodule " + name);
            sb.AppendLine();
            GitModule module = superproject.GetSubmodule(name);

            if (module.IsValidGitWorkingDir())
            {
                // TEMP, will be moved in the follow up refactor
                ICommitDataManager commitDataManager = new CommitDataManager(() => module);

                string     error = "";
                CommitData data  = commitDataManager.GetCommitData(hash, ref error);
                if (data == null)
                {
                    sb.AppendLine("Commit hash:\t" + hash);
                    return(sb.ToString());
                }

                string header = data.GetHeaderPlain();
                string body   = "\n" + data.Body.Trim();
                sb.AppendLine(header);
                sb.Append(body);
            }
            else
            {
                sb.AppendLine("Commit hash:\t" + hash);
            }
            return(sb.ToString());
        }