-
Notifications
You must be signed in to change notification settings - Fork 899
Ensure lack of optional parameters #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
494de48
14b3c1a
a897011
cb9ebe5
0a030f8
1bb9d42
d16fbec
bce3f4c
631b36c
4277559
9b26f36
1f9d9dd
0cfa923
d7e8a2e
b3386c9
40bbf1e
32da01c
44aa149
5109f59
62cc73e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHING_EMPTY_BRACES/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this change do? (asking for a friend) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I found myself dropping the default |
||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean> | ||
</wpf:ResourceDictionary> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,21 +9,44 @@ namespace LibGit2Sharp | |
/// </summary> | ||
public static class BlobExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected from the byte order mark | ||
/// </summary> | ||
/// <param name="blob">The blob for which the content will be returned.</param> | ||
/// <returns>Blob content as text.</returns> | ||
public static string GetContentText(this Blob blob) | ||
{ | ||
Ensure.ArgumentNotNull(blob, "blob"); | ||
|
||
return ReadToEnd(blob.GetContentStream(), null); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the blob content decoded with the specified encoding, | ||
/// or according to byte order marks, with UTF8 as fallback, | ||
/// if <paramref name="encoding"/> is null. | ||
/// or according to byte order marks, or the specified encoding as a fallback | ||
/// </summary> | ||
/// <param name="blob">The blob for which the content will be returned.</param> | ||
/// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param> | ||
/// <param name="encoding">The encoding of the text to use, if it cannot be detected</param> | ||
/// <returns>Blob content as text.</returns> | ||
public static string GetContentText(this Blob blob, Encoding encoding = null) | ||
public static string GetContentText(this Blob blob, Encoding encoding) | ||
{ | ||
Ensure.ArgumentNotNull(blob, "blob"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure.ArgumentNotNull(encoding, "encoding"); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
Ensure.ArgumentNotNull(encoding, "encoding"); | ||
|
||
return ReadToEnd(blob.GetContentStream(), encoding); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected | ||
/// </summary> | ||
/// <param name="blob">The blob for which the content will be returned.</param> | ||
/// <param name="filteringOptions">Parameter controlling content filtering behavior</param> | ||
/// <returns>Blob content as text.</returns> | ||
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions) | ||
{ | ||
return blob.GetContentText(filteringOptions, null); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the blob content as it would be checked out to the | ||
/// working directory, decoded with the specified encoding, | ||
|
@@ -34,7 +57,7 @@ public static string GetContentText(this Blob blob, Encoding encoding = null) | |
/// <param name="filteringOptions">Parameter controlling content filtering behavior</param> | ||
/// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param> | ||
/// <returns>Blob content as text.</returns> | ||
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding = null) | ||
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding) | ||
{ | ||
Ensure.ArgumentNotNull(blob, "blob"); | ||
Ensure.ArgumentNotNull(filteringOptions, "filteringOptions"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,46 @@ public static CommitRewriteInfo From(Commit commit) | |
}; | ||
} | ||
|
||
/// <summary> | ||
/// Build a <see cref="CommitRewriteInfo"/> from the <see cref="Commit"/> passed in, | ||
/// optionally overriding some of its properties | ||
/// </summary> | ||
/// <param name="commit">The <see cref="Commit"/> whose information is to be copied</param> | ||
/// <param name="author">Optional override for the author</param> | ||
/// <returns>A new <see cref="CommitRewriteInfo"/> object that matches the info for the | ||
/// <paramref name="commit"/> with the optional parameters replaced..</returns> | ||
public static CommitRewriteInfo From(Commit commit, Signature author) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd drop this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a test - |
||
{ | ||
return From(commit, author, null, null); | ||
} | ||
|
||
/// <summary> | ||
/// Build a <see cref="CommitRewriteInfo"/> from the <see cref="Commit"/> passed in, | ||
/// optionally overriding some of its properties | ||
/// </summary> | ||
/// <param name="commit">The <see cref="Commit"/> whose information is to be copied</param> | ||
/// <param name="message">Optional override for the message</param> | ||
/// <returns>A new <see cref="CommitRewriteInfo"/> object that matches the info for the | ||
/// <paramref name="commit"/> with the optional parameters replaced..</returns> | ||
public static CommitRewriteInfo From(Commit commit, string message) | ||
{ | ||
return From(commit, null, null, message); | ||
} | ||
|
||
/// <summary> | ||
/// Build a <see cref="CommitRewriteInfo"/> from the <see cref="Commit"/> passed in, | ||
/// optionally overriding some of its properties | ||
/// </summary> | ||
/// <param name="commit">The <see cref="Commit"/> whose information is to be copied</param> | ||
/// <param name="author">Optional override for the author</param> | ||
/// <param name="committer">Optional override for the committer</param> | ||
/// <returns>A new <see cref="CommitRewriteInfo"/> object that matches the info for the | ||
/// <paramref name="commit"/> with the optional parameters replaced..</returns> | ||
public static CommitRewriteInfo From(Commit commit, Signature author, Signature committer) | ||
{ | ||
return From(commit, author, committer, null); | ||
} | ||
|
||
/// <summary> | ||
/// Build a <see cref="CommitRewriteInfo"/> from the <see cref="Commit"/> passed in, | ||
/// optionally overriding some of its properties | ||
|
@@ -46,9 +86,9 @@ public static CommitRewriteInfo From(Commit commit) | |
/// <returns>A new <see cref="CommitRewriteInfo"/> object that matches the info for the | ||
/// <paramref name="commit"/> with the optional parameters replaced..</returns> | ||
public static CommitRewriteInfo From(Commit commit, | ||
Signature author = null, | ||
Signature committer = null, | ||
string message = null) | ||
Signature author, | ||
Signature committer, | ||
string message) | ||
{ | ||
var cri = From(commit); | ||
cri.Author = author ?? cri.Author; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a couple of methods which have optional parameters but are marked as obsolete. I figure we don't care about migrating those. Let me know if that's not the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! They'll be dropped before stabilization (post v0.22)