Skip to content

Commit

Permalink
Typos
Browse files Browse the repository at this point in the history
This is quite an extensive set of changes, done with the help of
ReSharper's upcoming spell checker, now in early access.
  • Loading branch information
drewnoakes committed Jul 22, 2018
1 parent a60ab4a commit 800e6c2
Show file tree
Hide file tree
Showing 119 changed files with 661 additions and 665 deletions.
2 changes: 1 addition & 1 deletion GitCommands/ArgumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace GitCommands
/// <code>
/// var args = new ArgumentBuilder
/// {
/// "commit", // adds the string unnconditionally
/// "commit", // adds the string unconditionally
/// { isAmend, "--amend" }, // adds the option only if isAmend == true
/// { isUp, "--up", "--down" }, // selects the option based on the value of isUp
/// };
Expand Down
4 changes: 2 additions & 2 deletions GitCommands/CommitDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void UpdateBody(CommitData commitData, out string error)

Debug.Assert(commitData.Guid.ToString() == guid, "Guid in response doesn't match that of request");

// Commit message is not reencoded by git when format is given
// Commit message is not re-encoded by git when format is given
commitData.Body = GetModule().ReEncodeCommitMessage(message, commitEncoding);
}

Expand Down Expand Up @@ -147,7 +147,7 @@ internal CommitData CreateFromFormattedData([NotNull] string data)
var commitEncoding = lines[7];
var message = ProcessDiffNotes(startIndex: 8, lines);

// commit message is not reencoded by git when format is given
// commit message is not re-encoded by git when format is given
var body = module.ReEncodeCommitMessage(message, commitEncoding);

return new CommitData(guid, treeGuid, parentGuids, author, authorDate, committer, commitDate, body);
Expand Down
6 changes: 3 additions & 3 deletions GitCommands/CommitTemplateItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ private static CommitTemplateItem[] DeserializeCommitTemplates(string serialized
int p = serializedString.IndexOf(':');
int length = Convert.ToInt32(serializedString.Substring(0, p));

byte[] memorydata = Convert.FromBase64String(serializedString.Substring(p + 1));
using (MemoryStream rs = new MemoryStream(memorydata, 0, length))
byte[] memoryData = Convert.FromBase64String(serializedString.Substring(p + 1));
using (var rs = new MemoryStream(memoryData, 0, length))
{
BinaryFormatter sf = new BinaryFormatter { Binder = new MoveNamespaceDeserializationBinder() };
var sf = new BinaryFormatter { Binder = new MoveNamespaceDeserializationBinder() };
commitTemplateItem = (CommitTemplateItem[])sf.Deserialize(rs);
}

Expand Down
6 changes: 2 additions & 4 deletions GitCommands/Config/ConfigFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ private void NewKey()

if (_section == null)
{
throw new Exception(
string.Format("Key {0} in configfile {1} is not in a section.", _key, FileName));
throw new Exception($"Key {_key} in config file {FileName} is not in a section.");
}
}

Expand All @@ -351,8 +350,7 @@ private void NewValue()

if (_key.IsNullOrEmpty())
{
throw new Exception(
string.Format("Value {0} for empty key in configfile {1}.", value, FileName));
throw new Exception($"Value {value} for empty key in config file {FileName}.");
}

_section.AddValue(_key, value);
Expand Down
4 changes: 2 additions & 2 deletions GitCommands/EnvironmentPathsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public IEnumerable<string> GetEnvironmentPaths()
yield break;
}

foreach (string rawdir in pathVariable.Split(EnvUtils.EnvVariableSeparator))
foreach (string rawDir in pathVariable.Split(EnvUtils.EnvVariableSeparator))
{
string dir = rawdir;
string dir = rawDir;

// Usually, paths with spaces are not quoted on %PATH%, but it's well possible, and .NET won't consume a quoted path
// This does not handle the full grammar of the %PATH%, but at least prevents Illegal Characters in Path exceptions (see #2924)
Expand Down
8 changes: 4 additions & 4 deletions GitCommands/ExternalLinks/ExternalLinksManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ExternalLinksManager(RepoDistSettings settings)
/// <summary>
/// Adds the provided definition at the lowest available level.
/// </summary>
/// <param name="definition">External link defintion.</param>
/// <param name="definition">External link definition.</param>
public void Add(ExternalLinkDefinition definition)
{
if (definition == null)
Expand All @@ -53,7 +53,7 @@ public void Add(ExternalLinkDefinition definition)
/// <summary>
/// Checks if a definition with the supplied name exists in any level of available settings.
/// </summary>
/// <param name="definitionName">The name of the defintion to find.</param>
/// <param name="definitionName">The name of the definition to find.</param>
/// <returns><see langword="true"/> if a definition already exists; otherwise <see langword="false"/>.</returns>
public bool Contains(string definitionName)
{
Expand All @@ -72,9 +72,9 @@ public IReadOnlyList<ExternalLinkDefinition> GetEffectiveSettings()
}

/// <summary>
/// Removes the supplied deifintion.
/// Removes the supplied definition.
/// </summary>
/// <param name="definition">External link defintion.</param>
/// <param name="definition">External link definition.</param>
public void Remove(ExternalLinkDefinition definition)
{
if (!_definitions.Remove(definition))
Expand Down
6 changes: 3 additions & 3 deletions GitCommands/FileAssociatedIconProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface IFileAssociatedIconProvider
/// </summary>
/// <param name="workingDirectory">The git repository working directory.</param>
/// <param name="relativeFilePath">The relative path to the file.</param>
/// <returns>The icon associaited with the given file type or <see langword="null"/>.</returns>
/// <returns>The icon associated with the given file type or <see langword="null"/>.</returns>
Icon Get(string workingDirectory, string relativeFilePath);
}

Expand Down Expand Up @@ -44,9 +44,9 @@ public FileAssociatedIconProvider()
/// </summary>
/// <param name="workingDirectory">The git repository working directory.</param>
/// <param name="relativeFilePath">The relative path to the file.</param>
/// <returns>The icon associaited with the given file type or <see langword="null"/>.</returns>
/// <returns>The icon associated with the given file type or <see langword="null"/>.</returns>
/// <remarks>
/// The method takes two parameters to performance reasons - the full path is esstablished
/// The method takes two parameters to performance reasons - the full path is established
/// only if the file type has not been processed already and the extensions is not cached.
/// </remarks>
public Icon Get(string workingDirectory, string relativeFilePath)
Expand Down
4 changes: 2 additions & 2 deletions GitCommands/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static bool IsBinaryFile(GitModule module, string fileName)
/// <returns>null if no info in .gitattributes (or ambiguous). True if marked as binary, false if marked as text</returns>
private static bool? IsBinaryAccordingToGitAttributes(GitModule module, string fileName)
{
string[] diffvals = { "set", "astextplain", "ada", "bibtext", "cpp", "csharp", "fortran", "html", "java", "matlab", "objc", "pascal", "perl", "php", "python", "ruby", "tex" };
string[] diffValues = { "set", "astextplain", "ada", "bibtext", "cpp", "csharp", "fortran", "html", "java", "matlab", "objc", "pascal", "perl", "php", "python", "ruby", "tex" };
string cmd = "check-attr -z diff text crlf eol -- " + fileName.Quote();
string result = module.RunGitCmd(cmd);
var lines = result.Split('\n', '\0');
Expand All @@ -84,7 +84,7 @@ public static bool IsBinaryFile(GitModule module, string fileName)
return true;
}

if (diffvals.Contains(diff))
if (diffValues.Contains(diff))
{
return false;
}
Expand Down
38 changes: 19 additions & 19 deletions GitCommands/Git/GitCommandHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ private static Process StartProcessAndReadAllBytes(string arguments, string cmd,
/// <summary>
/// Run command, console window is hidden, wait for exit, redirect output
/// </summary>
public static int RunCmdByte(string cmd, string arguments, string workingdir, byte[] stdInput, out byte[] output, out byte[] error)
public static int RunCmdByte(string cmd, string arguments, string workingDir, byte[] stdInput, out byte[] output, out byte[] error)
{
try
{
arguments = arguments.Replace("$QUOTE$", "\\\"");
using (var process = StartProcessAndReadAllBytes(arguments, cmd, workingdir, out output, out error, stdInput))
using (var process = StartProcessAndReadAllBytes(arguments, cmd, workingDir, out output, out error, stdInput))
{
process.WaitForExit();
return process.ExitCode;
Expand Down Expand Up @@ -409,7 +409,7 @@ public static string ResetHardCmd(string commit)
/// <param name="branch">
/// <para><c>NULL</c>: do not checkout working copy (--no-checkout).</para>
/// <para><c>""</c> (empty string): checkout remote HEAD (branch param omitted, default behavior for clone).</para>
/// <para>(a non-empty string): checkout the given branch (--branch smth).</para>
/// <para>(a non-empty string): checkout the given branch (--branch some_branch).</para>
/// </param>
/// <param name="depth">An int value for --depth param, or <c>NULL</c> to omit the param.</param>
/// <param name="isSingleBranch">
Expand Down Expand Up @@ -464,7 +464,7 @@ public static string CreateOrphanCmd(string newBranchName, string startPoint = n
/// <summary>Remove files from the working tree and from the index. <remarks>git rm</remarks></summary>
/// <param name="force">Override the up-to-date check.</param>
/// <param name="isRecursive">Allow recursive removal when a leading directory name is given.</param>
/// <param name="files">Files to remove. Fileglobs can be given to remove matching files.</param>
/// <param name="files">Files to remove. File globs can be given to remove matching files.</param>
public static string RemoveCmd(bool force = true, bool isRecursive = true, params string[] files)
{
var args = new ArgumentBuilder
Expand Down Expand Up @@ -601,7 +601,7 @@ public static string StopBisectCmd()
return "bisect reset";
}

public static string RebaseCmd(string branch, bool interactive, bool preserveMerges, bool autosquash, bool autostash, string from = null, string onto = null)
public static string RebaseCmd(string branch, bool interactive, bool preserveMerges, bool autosquash, bool autoStash, string from = null, string onto = null)
{
if (from == null ^ onto == null)
{
Expand All @@ -615,7 +615,7 @@ public static string RebaseCmd(string branch, bool interactive, bool preserveMer
{ interactive && autosquash, "--autosquash" },
{ interactive && !autosquash, "--no-autosquash" },
{ preserveMerges, "--preserve-merges" },
{ autostash, "--autostash" },
{ autoStash, "--autostash" },
from.QuoteNE(),
branch.Quote(),
{ onto != null, $"--onto {onto}" }
Expand Down Expand Up @@ -672,16 +672,16 @@ public static string ApplyDiffPatchCmd(bool ignoreWhiteSpace, [NotNull] string p
return args.ToString();
}

public static string CleanUpCmd(bool dryrun, bool directories, bool nonignored, bool ignored, string paths = null)
public static string CleanUpCmd(bool dryRun, bool directories, bool nonIgnored, bool ignored, string paths = null)
{
var args = new ArgumentBuilder
{
"clean",
{ directories, "-d" },
{ !nonignored && !ignored, "-x" },
{ !nonIgnored && !ignored, "-x" },
{ ignored, "-X" },
{ dryrun, "--dry-run" },
{ !dryrun, "-f" },
{ dryRun, "--dry-run" },
{ !dryRun, "-f" },
paths
};

Expand Down Expand Up @@ -764,7 +764,7 @@ public static GitSubmoduleStatus GetSubmoduleStatus(string text, GitModule modul
hash = line.Substring(pos + commit.Length);
}

bool bdirty = hash.EndsWith("-dirty");
bool isDirty = hash.EndsWith("-dirty");
hash = hash.Replace("-dirty", "");
if (c == '-')
{
Expand All @@ -773,7 +773,7 @@ public static GitSubmoduleStatus GetSubmoduleStatus(string text, GitModule modul
else if (c == '+')
{
status.Commit = hash;
status.IsDirty = bdirty;
status.IsDirty = isDirty;
}

// TODO: Support combined merge
Expand Down Expand Up @@ -1035,8 +1035,8 @@ private static IReadOnlyList<GitItemStatus> GetAllChangedFilesFromString_v1(IGit
if (x == 'R' || x == 'C')
{
// Find renamed files...
string nextfile = n + 1 < files.Length ? files[n + 1] : "";
gitItemStatusX = GitItemStatusFromCopyRename(stagedX, fromDiff, nextfile, fileName, x, status);
string nextFile = n + 1 < files.Length ? files[n + 1] : "";
gitItemStatusX = GitItemStatusFromCopyRename(stagedX, fromDiff, nextFile, fileName, x, status);
n++;
}
else
Expand All @@ -1062,8 +1062,8 @@ private static IReadOnlyList<GitItemStatus> GetAllChangedFilesFromString_v1(IGit
if (y == 'R' || y == 'C')
{
// Find renamed files...
string nextfile = n + 1 < files.Length ? files[n + 1] : "";
gitItemStatusY = GitItemStatusFromCopyRename(stagedY, false, nextfile, fileName, y, status);
string nextFile = n + 1 < files.Length ? files[n + 1] : "";
gitItemStatusY = GitItemStatusFromCopyRename(stagedY, false, nextFile, fileName, y, status);
n++;
}
else
Expand Down Expand Up @@ -1122,20 +1122,20 @@ public static List<GitItemStatus> GetSkipWorktreeFilesFromString(string lsString
return result;
}

private static GitItemStatus GitItemStatusFromCopyRename(StagedStatus staged, bool fromDiff, string nextfile, string fileName, char x, string status)
private static GitItemStatus GitItemStatusFromCopyRename(StagedStatus staged, bool fromDiff, string nextFile, string fileName, char x, string status)
{
var gitItemStatus = new GitItemStatus();

// Find renamed files...
if (fromDiff)
{
gitItemStatus.OldName = fileName.Trim();
gitItemStatus.Name = nextfile.Trim();
gitItemStatus.Name = nextFile.Trim();
}
else
{
gitItemStatus.Name = fileName.Trim();
gitItemStatus.OldName = nextfile.Trim();
gitItemStatus.OldName = nextFile.Trim();
}

gitItemStatus.IsNew = false;
Expand Down
10 changes: 5 additions & 5 deletions GitCommands/Git/GitDirectoryResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public string Resolve(string repositoryPath)
return string.Empty;
}

var gitpath = Path.Combine(repositoryPath, ".git");
if (_fileSystem.File.Exists(gitpath))
var gitPath = Path.Combine(repositoryPath, ".git");
if (_fileSystem.File.Exists(gitPath))
{
var line = _fileSystem.File.ReadLines(gitpath).FirstOrDefault(l => l.StartsWith("gitdir:"));
var line = _fileSystem.File.ReadLines(gitPath).FirstOrDefault(l => l.StartsWith("gitdir:"));
if (line != null)
{
string path = line.Substring(7).Trim().ToNativePath();
Expand All @@ -91,8 +91,8 @@ public string Resolve(string repositoryPath)
}
}

gitpath = gitpath.EnsureTrailingPathSeparator();
return !_fileSystem.Directory.Exists(gitpath) ? repositoryPath : gitpath;
gitPath = gitPath.EnsureTrailingPathSeparator();
return !_fileSystem.Directory.Exists(gitPath) ? repositoryPath : gitPath;
}
}
}
Loading

0 comments on commit 800e6c2

Please sign in to comment.