private void AddComment(string comment, ref string args, out TempFile tempFile) { tempFile = null; if (!string.IsNullOrEmpty(comment)) { // need to use a temporary file to specify the comment when not // using the system default code page or it contains newlines if (commitEncoding.CodePage != Encoding.Default.CodePage || comment.IndexOf('\n') >= 0) { Logger.WriteLine("Generating temp file for comment: {0}", comment); tempFile = new TempFile(); tempFile.Write(comment, commitEncoding); // temporary path might contain spaces (e.g. "Documents and Settings") args += " -F " + Quote(tempFile.Name); } else { args += " -m " + Quote(comment); } } }
private string GetCommentOption(string comment, out TempFile tempFile) { if (comment.StartsWith("-")) { tempFile = new TempFile(); tempFile.Write(comment, Encoding.UTF8); return "-F " + Quote(tempFile.Name); } else { tempFile = null; return "-m " + Quote(comment); } }