<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.TemplateEngine.Cli
{
    internal class GitSource
    {
        public string GitUrl { get; set; }
        public string SubFolder { get; set; }
        public string RepositoryName { get; set; }

        public GitSource(string gitUrl, string subFolder, string repoName)
        {
            GitUrl = gitUrl;
            SubFolder = subFolder;
            RepositoryName = repoName;
        }

        public static bool TryParseGitSource(string spec, out GitSource package)
        {
            package = null;
            int gitIndex = -1;
            Uri uri = null;

            if (string.IsNullOrEmpty(spec) 
                || Uri.TryCreate(spec, UriKind.Absolute, out uri) == false
                || (gitIndex = spec.IndexOf(".git", StringComparison.OrdinalIgnoreCase)) < 0)
            {
                return false;
            }
            else
            {
                int index = gitIndex + 4;
                int indexOfLastSlashBeforeGit = -1;
                int indexOfSlash = -1;
                while ((indexOfSlash = spec.IndexOf('/', indexOfLastSlashBeforeGit + 1)) < index && indexOfSlash != -1)
                {
                    indexOfLastSlashBeforeGit = indexOfSlash;<commit_msg>replaced magic int with readonly field length<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.TemplateEngine.Cli
{
    internal class GitSource
    {
        static readonly string _gitExtension = ".git";

        public string GitUrl { get; set; }
        public string SubFolder { get; set; }
        public string RepositoryName { get; set; }

        public GitSource(string gitUrl, string subFolder, string repoName)
        {
            GitUrl = gitUrl;
            SubFolder = subFolder;
            RepositoryName = repoName;
        }

        public static bool TryParseGitSource(string spec, out GitSource package)
        {
            package = null;
            int gitIndex = -1;
            Uri uri = null;

            if (string.IsNullOrEmpty(spec) 
                || Uri.TryCreate(spec, UriKind.Absolute, out uri) == false
                || (gitIndex = spec.IndexOf(_gitExtension, StringComparison.OrdinalIgnoreCase)) < 0)
            {
                return false;
            }
            else
            {
                int index = gitIndex + _gitExtension.Length;
                int indexOfLastSlashBeforeGit = -1;
                int indexOfSlash = -1;
                while ((indexOfSlash = spec.IndexOf('/', indexOfLastSlashBeforeGit + 1)) < index && indexOfSlash != -1)
                {
                    indexOfLastSlashBeforeGit = indexOfSlash;
{'fraction_non_alphanumeric': 0.08285094066570188, 'fraction_numerical': 0.004703328509406657, 'mean_word_length': 1.7134445534838076, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1451224', 'n_tokens_mistral': 748, 'n_tokens_neox': 695, 'n_words': 188}