From 5da5926407a39ad93cdc2b7ee4dd2551b2856fac Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Mar 2011 17:53:49 +0000 Subject: [PATCH] [fetcher] Fix InstallConfiguration method --- SparkleLib/SparkleFetcher.cs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/SparkleLib/SparkleFetcher.cs b/SparkleLib/SparkleFetcher.cs index 566d1455..f8d26fc7 100644 --- a/SparkleLib/SparkleFetcher.cs +++ b/SparkleLib/SparkleFetcher.cs @@ -83,7 +83,7 @@ namespace SparkleLib { } else { - InstallUserInfo (); + InstallConfiguration (); InstallExcludeRules (); SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned"); @@ -101,30 +101,32 @@ namespace SparkleLib { } - // Install the user's name and email into - // the newly cloned repository - private void InstallUserInfo () - { + private void InstallConfiguration () + { - string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config"); + string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config"); - if (File.Exists (global_config_file_path)) { + if (File.Exists (global_config_file_path)) { - StreamReader reader = new StreamReader (global_config_file_path); - string user_info = reader.ReadToEnd (); - reader.Close (); + StreamReader reader = new StreamReader (global_config_file_path); + string user_info = reader.ReadToEnd (); + reader.Close (); - string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config"); + string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config"); - TextWriter writer = File.AppendText (repo_config_file_path); - writer.WriteLine (user_info); - writer.Close (); + string config = String.Join ("\n", File.ReadAllLines (repo_config_file_path)); + config = config.Replace ("ignorecase = true", "ignorecase = false"); + config += Environment.NewLine + user_info; - SparkleHelpers.DebugInfo ("Config", "Added user info to '" + repo_config_file_path + "'"); + TextWriter writer = new StreamWriter (repo_config_file_path); + writer.WriteLine (config); + writer.Close (); - } + SparkleHelpers.DebugInfo ("Config", "Added configuration to '" + repo_config_file_path + "'"); - } + } + + } // Add a .gitignore file to the repo