[fetcher] Fix InstallConfiguration method
This commit is contained in:
parent
ad712b6919
commit
fa4e7dd368
|
@ -83,7 +83,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
InstallUserInfo ();
|
InstallConfiguration ();
|
||||||
InstallExcludeRules ();
|
InstallExcludeRules ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned");
|
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned");
|
||||||
|
@ -101,30 +101,32 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Install the user's name and email into
|
private void InstallConfiguration ()
|
||||||
// the newly cloned repository
|
{
|
||||||
private void InstallUserInfo ()
|
|
||||||
{
|
|
||||||
|
|
||||||
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);
|
StreamReader reader = new StreamReader (global_config_file_path);
|
||||||
string user_info = reader.ReadToEnd ();
|
string user_info = reader.ReadToEnd ();
|
||||||
reader.Close ();
|
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);
|
string config = String.Join ("\n", File.ReadAllLines (repo_config_file_path));
|
||||||
writer.WriteLine (user_info);
|
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
||||||
writer.Close ();
|
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
|
// Add a .gitignore file to the repo
|
||||||
|
|
Loading…
Reference in a new issue