private static string GetChangedFileText(GitModule module, GitItemStatus file) { var changes = module.GetCurrentChanges(file.Name, file.OldName, file.IsStaged, "-U1000000", module.FilesEncoding); if (changes != null) return changes.Text; var content = module.GetFileContents(file); if (content != null) return content; return File.ReadAllText(Path.Combine(module.WorkingDir, file.Name)); }
private static string GetChangedFileText (GitModule module, GitItemStatus file) { var changes = module.GetCurrentChanges(file.Name, file.OldName, file.IsStaged, "-U1000000", module.FilesEncoding); if (changes != null) return changes.Text; var content = module.GetFileContents(file); if (content != null) return content; // Try to read the contents of the file: if it cannot be read, skip the operation silently. try { return File.ReadAllText(Path.Combine(module.WorkingDir, file.Name)); } catch { return ""; } }