private static async Task <string> GetChangedFileTextAsync(VsrModule module, GitItemStatus file) { var changes = await module.GetCurrentChangesAsync(file.Name, file.OldName, file.Staged == StagedStatus.Index, "-U1000000") .ConfigureAwait(false); if (changes != null) { return(changes.Text); } var content = await module.GetFileContentsAsync(file).ConfigureAwaitRunInline(); if (content != null) { return(content); } // Try to read the contents of the file: if it cannot be read, skip the operation silently. try { using (var reader = File.OpenText(Path.Combine(module.WorkingDir, file.Name))) { return(await reader.ReadToEndAsync()); } } catch { return(""); } }
public static async Task <GitSubmoduleStatus> GetCurrentSubmoduleChangesAsync(VsrModule module, string fileName, string oldFileName, bool staged, bool noLocks = false) { Patch patch = await module.GetCurrentChangesAsync(fileName, oldFileName, staged, "", noLocks : noLocks).ConfigureAwait(false); string text = patch != null ? patch.Text : ""; return(ParseSubmoduleStatus(text, module, fileName)); }