From 537218b46e5e210730070c6fb702e81956f56fc7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 17 Oct 2011 19:34:17 +0200 Subject: [PATCH] git: Always use user info from global config to commit. Fixes #367 --- SparkleLib/Git/SparkleFetcherGit.cs | 19 ------------------- SparkleLib/Git/SparkleRepoGit.cs | 6 +++++- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 11a39046..76434db1 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -153,11 +153,6 @@ namespace SparkleLib { // the newly cloned repository private void InstallConfiguration () { - string global_config_file_path = Path.Combine (SparkleConfig.DefaultConfig.TmpPath, "config.xml"); - - if (!File.Exists (global_config_file_path)) - return; - string repo_config_file_path = SparkleHelpers.CombineMore (base.target_folder, ".git", "config"); string config = String.Join (Environment.NewLine, File.ReadAllLines (repo_config_file_path)); @@ -173,20 +168,6 @@ namespace SparkleLib { // Ignore permission changes config = config.Replace ("filemode = true", "filemode = false"); - - // Add user info - XmlDocument xml = new XmlDocument(); - xml.Load (global_config_file_path); - - XmlNode node_name = xml.SelectSingleNode ("//user/name/text()"); - XmlNode node_email = xml.SelectSingleNode ("//user/email/text()"); - - // TODO: just use commands instead of messing with the config file - config += n + - "[user]" + n + - "\tname = " + node_name.Value + n + - "\temail = " + node_email.Value + n; - // Write the config to the file TextWriter writer = new StreamWriter (repo_config_file_path); writer.WriteLine (config); diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 8d7229f7..cb048e92 100755 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -234,7 +234,11 @@ namespace SparkleLib { // Commits the made changes private void Commit (string message) { - SparkleGit git = new SparkleGit (LocalPath, "commit -m \"" + message + "\""); + SparkleGit git = new SparkleGit (LocalPath, + "commit -m \"" + message + "\" " + + "--author=\"" + SparkleConfig.DefaultConfig.User.Name + + " <" + SparkleConfig.DefaultConfig.User.Email + ">\""); + git.Start (); git.StandardOutput.ReadToEnd (); git.WaitForExit ();