<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using NDesk.Options;
using Sep.Git.Tfs.Core;
using StructureMap;

namespace Sep.Git.Tfs.Commands
{
    [Pluggable("bootstrap")]
    [RequiresValidGitRepository]
    [Description("bootstrap [parent-commit]")]
    public class Bootstrap : GitTfsCommand
    {
        private readonly RemoteOptions _remoteOptions;
        private readonly Globals _globals;
        private readonly TextWriter _stdout;

        public Bootstrap(RemoteOptions remoteOptions, Globals globals, TextWriter stdout)
        {
            _remoteOptions = remoteOptions;
            _globals = globals;
            _stdout = stdout;
        }

        public OptionSet OptionSet
        {
            get { return _remoteOptions.OptionSet; }
        }

        public int Run()
        {
            return Run("HEAD");
        }

        public int Run(string commitish)
        {
            var tfsParents = _globals.Repository.GetLastParentTfsCommits(commitish, true);
            foreach (var parent in tfsParents)
            {
                GitCommit commit = _globals.Repository.GetCommit(parent.GitCommit);
                _stdout.WriteLine("commit {0}\nAuthor: {1} <{2}>\nDate:   {3}\n\n    {4}",
                    commit.Sha,
                    commit.AuthorAndEmail.Item1, commit.AuthorAndEmail.Item2,
                    commit.When.ToString("ddd MMM d HH:mm:ss zzz"),
                    commit.Message.Replace("\n","\n    ").TrimEnd(' '));
                if (parent.Remote.IsDerived)
                {
                    var remoteId = GetRemoteId(parent);
                    var remote = _globals.Repository.CreateTfsRemote(new RemoteInfo
                    {
                        Id = remoteId,
                        Url = parent.Remote.TfsUrl,
                        Repository = parent.Remote.TfsRepositoryPath,
                        RemoteOptions = _remoteOptions,
                    });<commit_msg>correct overwriting of autocrlf setting when bootstrapping<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using NDesk.Options;
using Sep.Git.Tfs.Core;
using StructureMap;

namespace Sep.Git.Tfs.Commands
{
    [Pluggable("bootstrap")]
    [RequiresValidGitRepository]
    [Description("bootstrap [parent-commit]")]
    public class Bootstrap : GitTfsCommand
    {
        private readonly RemoteOptions _remoteOptions;
        private readonly Globals _globals;
        private readonly TextWriter _stdout;

        public Bootstrap(RemoteOptions remoteOptions, Globals globals, TextWriter stdout)
        {
            _remoteOptions = remoteOptions;
            _globals = globals;
            _stdout = stdout;
        }

        public OptionSet OptionSet
        {
            get { return _remoteOptions.OptionSet; }
        }

        public int Run()
        {
            return Run("HEAD");
        }

        public int Run(string commitish)
        {
            var tfsParents = _globals.Repository.GetLastParentTfsCommits(commitish, true);
            foreach (var parent in tfsParents)
            {
                GitCommit commit = _globals.Repository.GetCommit(parent.GitCommit);
                _stdout.WriteLine("commit {0}\nAuthor: {1} <{2}>\nDate:   {3}\n\n    {4}",
                    commit.Sha,
                    commit.AuthorAndEmail.Item1, commit.AuthorAndEmail.Item2,
                    commit.When.ToString("ddd MMM d HH:mm:ss zzz"),
                    commit.Message.Replace("\n","\n    ").TrimEnd(' '));
                if (parent.Remote.IsDerived)
                {
                    var remoteId = GetRemoteId(parent);
                    var remote = _globals.Repository.CreateTfsRemote(new RemoteInfo
                    {
                        Id = remoteId,
                        Url = parent.Remote.TfsUrl,
                        Repository = parent.Remote.TfsRepositoryPath,
                        RemoteOptions = _remoteOptions,
                    }, string.Empty);
{'fraction_non_alphanumeric': 0.08794394781348151, 'fraction_numerical': 0.0033824595312877508, 'mean_word_length': 1.7692307692307692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1435023', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1059, 'n_words': 229}