Пример #1
0
        public static GitLfsTrackedInfo Parse(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return(null);
            }
            string[] chunks = data.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (chunks.Length < 5)
            {
                return(null);
            }
            GitLfsTrackedInfo info = new GitLfsTrackedInfo
            {
                extension = chunks[0].Trim(),
                filter    = chunks[1].Trim(),
                diff      = chunks[2].Trim(),
                merge     = chunks[3].Trim()
            };
            string typeString = chunks[4].Trim();

            if (typeString.EndsWith("delta"))
            {
                info.type = TrackType.Delta;
            }
            else if (typeString.EndsWith("text"))
            {
                info.type = TrackType.Text;
            }
            return(info);
        }
Пример #2
0
        public static void Update()
        {
            RegisterFilter();

            if (File.Exists(GitManager.RepoPath + @"\.gitattributes"))
            {
                using (TextReader file = File.OpenText(GitManager.RepoPath + @"\.gitattributes"))
                {
                    trackedInfo = file.ReadToEnd().Split('\n').Select(l => GitLfsTrackedInfo.Parse(l)).Where(l => l != null).ToArray();
                }
            }
        }