GitCommands.GitModule.UnstageFiles C# (CSharp) Method

UnstageFiles() public method

public UnstageFiles ( IList files ) : string
files IList
return string
        public string UnstageFiles(IList<GitItemStatus> files)
        {
            var output = "";
            string error = "";
            var startInfo = CreateGitStartInfo("update-index --info-only --index-info");
            var processReader = new Lazy<SynchronizedProcessReader>(() => new SynchronizedProcessReader(Process.Start(startInfo)));
            foreach (var file in files.Where(file => !file.IsNew))
            {
                processReader.Value.Process.StandardInput.WriteLine("0 0000000000000000000000000000000000000000\t\"" + file.Name.ToPosixPath() + "\"");
            }
            if (processReader.IsValueCreated)
            {
                processReader.Value.Process.StandardInput.Close();
                processReader.Value.WaitForExit();
                output = processReader.Value.OutputString(SystemEncoding);
                error = processReader.Value.ErrorString(SystemEncoding);
            }

            startInfo.Arguments = "update-index --force-remove --stdin";
            processReader = new Lazy<SynchronizedProcessReader>(() => new SynchronizedProcessReader(Process.Start(startInfo)));
            foreach (var file in files.Where(file => file.IsNew))
            {
                UpdateIndex(processReader, file.Name);
            }
            if (processReader.IsValueCreated)
            {
                processReader.Value.Process.StandardInput.Close();
                processReader.Value.WaitForExit();
                output = output.Combine(Environment.NewLine, processReader.Value.OutputString(SystemEncoding));
                error = error.Combine(Environment.NewLine, processReader.Value.ErrorString(SystemEncoding));
            }

            return output.Combine(Environment.NewLine, error);
        }
GitModule