示例#1
0
        // Standard constructor
        private GitLocalRepository(string location)
        {
            Location = location;

            var result = GitController.Default.TryExecute(GitCommandBuilder.Format(Location, "%H"));

            Hash = result ? "" : result.Out.ToLowerInvariant();
        }
示例#2
0
        /// <summary>
        /// Is valid repository
        /// </summary>
        public static bool IsRepository(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                path = Environment.CurrentDirectory;
            }

            if (!Directory.Exists(path))
            {
                return(false);
            }

            var result = GitController.Default.TryExecute(GitCommandBuilder.Format(path, "%H"));

            return(!string.IsNullOrEmpty(result.Out) &&
                   result.Out.All(c => c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F'));
        }