Exemple #1
0
        /// <returns>
        /// Returns a enumeration of the submodule-paths of <paramref name="repositoryFolder"/>.
        /// </returns>
        public static IEnumerable <string> GetGitSubmodulePaths(string repositoryFolder, bool recursive = true)
        {
            GitCommandResult commandresult = ExecuteGitCommand(repositoryFolder, "submodule status" + (recursive ? " --recursive" : string.Empty), true);
            List <string>    result        = new();

            foreach (string rawLine in commandresult.StdOutLines)
            {
                string line = rawLine.Trim();
                if (line.Contains(" "))
                {
                    string[] splitted            = line.Split(' ');
                    int      amountOfWhitespaces = splitted.Length - 1;
                    if (0 < amountOfWhitespaces)
                    {
                        string rawPath = splitted[1];
                        if (rawPath.Contains("..") || rawPath == "./")
                        {
                            continue;
                        }
                        else
                        {
                            result.Add(Path.Combine(repositoryFolder, rawPath.Replace("/", Path.DirectorySeparatorChar.ToString())));
                        }
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        private static bool GitChangesHelper(string repositoryFolder, string argument)
        {
            GitCommandResult result = ExecuteGitCommand(repositoryFolder, argument, true);

            foreach (string line in result.StdOutLines)
            {
                if (!string.IsNullOrWhiteSpace(line))
                {
                    return(true);
                }
            }
            return(false);
        }