git: Always use user info from global config to commit. Fixes #367

This commit is contained in:
Hylke Bons 2011-10-17 19:34:17 +02:00
parent f860e8e564
commit 537218b46e
2 changed files with 5 additions and 20 deletions

View file

@ -153,11 +153,6 @@ namespace SparkleLib {
// the newly cloned repository // the newly cloned repository
private void InstallConfiguration () 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 repo_config_file_path = SparkleHelpers.CombineMore (base.target_folder, ".git", "config");
string config = String.Join (Environment.NewLine, File.ReadAllLines (repo_config_file_path)); string config = String.Join (Environment.NewLine, File.ReadAllLines (repo_config_file_path));
@ -173,20 +168,6 @@ namespace SparkleLib {
// Ignore permission changes // Ignore permission changes
config = config.Replace ("filemode = true", "filemode = false"); 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 // Write the config to the file
TextWriter writer = new StreamWriter (repo_config_file_path); TextWriter writer = new StreamWriter (repo_config_file_path);
writer.WriteLine (config); writer.WriteLine (config);

View file

@ -234,7 +234,11 @@ namespace SparkleLib {
// Commits the made changes // Commits the made changes
private void Commit (string message) 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.Start ();
git.StandardOutput.ReadToEnd (); git.StandardOutput.ReadToEnd ();
git.WaitForExit (); git.WaitForExit ();