From 494de485d2ba2aa4d5e3f9603295acd722ae9206 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:50:07 +0200 Subject: Drop optional parameters in TagCollection --- LibGit2Sharp/TagCollection.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/TagCollection.cs b/LibGit2Sharp/TagCollection.cs index 04c42609..603ab66d 100644 --- a/LibGit2Sharp/TagCollection.cs +++ b/LibGit2Sharp/TagCollection.cs @@ -69,6 +69,19 @@ namespace LibGit2Sharp #endregion + /// + /// Creates an annotated tag with the specified name. + /// + /// The name. + /// The target . + /// The tagger. + /// The message. + /// The added . + public virtual Tag Add(string name, GitObject target, Signature tagger, string message) + { + return Add(name, target, tagger, message, false); + } + /// /// Creates an annotated tag with the specified name. /// @@ -78,7 +91,7 @@ namespace LibGit2Sharp /// The message. /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The added . - public virtual Tag Add(string name, GitObject target, Signature tagger, string message, bool allowOverwrite = false) + public virtual Tag Add(string name, GitObject target, Signature tagger, string message, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(target, "target"); @@ -92,6 +105,17 @@ namespace LibGit2Sharp return this[name]; } + /// + /// Creates a lightweight tag with the specified name. + /// + /// The name. + /// The target . + /// The added . + public virtual Tag Add(string name, GitObject target) + { + return Add(name, target, false); + } + /// /// Creates a lightweight tag with the specified name. /// @@ -99,7 +123,7 @@ namespace LibGit2Sharp /// The target . /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The added . - public virtual Tag Add(string name, GitObject target, bool allowOverwrite = false) + public virtual Tag Add(string name, GitObject target, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(target, "target"); -- cgit v1.2.3 From 14b3c1a488dd1489c084be80ebc0c99955535b6b Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:50:46 +0200 Subject: Drop optional parameters in RepositoryExtensions --- LibGit2Sharp/RepositoryExtensions.cs | 61 +++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/LibGit2Sharp/RepositoryExtensions.cs b/LibGit2Sharp/RepositoryExtensions.cs index 7e37ef2f..f54d3ed8 100644 --- a/LibGit2Sharp/RepositoryExtensions.cs +++ b/LibGit2Sharp/RepositoryExtensions.cs @@ -152,13 +152,24 @@ namespace LibGit2Sharp } /// - /// Sets the current to the specified commit and optionally resets the and + /// Sets the current and resets the and + /// the content of the working tree to match. + /// + /// The being worked with. + /// Flavor of reset operation to perform. + public static void Reset(this IRepository repository, ResetMode resetMode) + { + repository.Reset(resetMode, "HEAD"); + } + + /// + /// Sets the current to the specified commitish and optionally resets the and /// the content of the working tree to match. /// /// The being worked with. /// Flavor of reset operation to perform. /// A revparse spec for the target commit object. - public static void Reset(this IRepository repository, ResetMode resetMode, string committish = "HEAD") + public static void Reset(this IRepository repository, ResetMode resetMode, string committish) { Ensure.ArgumentNotNullOrEmptyString(committish, "committish"); @@ -199,6 +210,20 @@ namespace LibGit2Sharp return obj.DereferenceToCommit(true); } + /// + /// Stores the content of the as a new into the repository. + /// The tip of the will be used as the parent of this new Commit. + /// Once the commit is created, the will move forward to point at it. + /// Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable. + /// + /// The being worked with. + /// The description of why a change was made to the repository. + /// The generated . + public static Commit Commit(this IRepository repository, string message) + { + return repository.Commit(message, (CommitOptions)null); + } + /// /// Stores the content of the as a new into the repository. /// The tip of the will be used as the parent of this new Commit. @@ -209,13 +234,29 @@ namespace LibGit2Sharp /// The description of why a change was made to the repository. /// The that specify the commit behavior. /// The generated . - public static Commit Commit(this IRepository repository, string message, CommitOptions options = null) + public static Commit Commit(this IRepository repository, string message, CommitOptions options) { Signature author = repository.Config.BuildSignature(DateTimeOffset.Now, true); return repository.Commit(message, author, options); } + /// + /// Stores the content of the as a new into the repository. + /// The tip of the will be used as the parent of this new Commit. + /// Once the commit is created, the will move forward to point at it. + /// The Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable. + /// + /// The being worked with. + /// The of who made the change. + /// The description of why a change was made to the repository. + /// The generated . + public static Commit Commit(this IRepository repository, string message, Signature author) + { + return repository.Commit(message, author, (CommitOptions)null); + } + + /// /// Stores the content of the as a new into the repository. /// The tip of the will be used as the parent of this new Commit. @@ -227,20 +268,30 @@ namespace LibGit2Sharp /// The description of why a change was made to the repository. /// The that specify the commit behavior. /// The generated . - public static Commit Commit(this IRepository repository, string message, Signature author, CommitOptions options = null) + public static Commit Commit(this IRepository repository, string message, Signature author, CommitOptions options) { Signature committer = repository.Config.BuildSignature(DateTimeOffset.Now, true); return repository.Commit(message, author, committer, options); } + /// + /// Fetch from the specified remote. + /// + /// The being worked with. + /// The name of the to fetch from. + public static void Fetch(this IRepository repository, string remoteName) + { + repository.Fetch(remoteName, null); + } + /// /// Fetch from the specified remote. /// /// The being worked with. /// The name of the to fetch from. /// controlling fetch behavior - public static void Fetch(this IRepository repository, string remoteName, FetchOptions options = null) + public static void Fetch(this IRepository repository, string remoteName, FetchOptions options) { Ensure.ArgumentNotNull(repository, "repository"); Ensure.ArgumentNotNullOrEmptyString(remoteName, "remoteName"); -- cgit v1.2.3 From a8970119bce765ea4ca18d73fb724e924467607f Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:51:41 +0200 Subject: Drop optional parameters in Repository.cs --- LibGit2Sharp/Repository.cs | 47 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index f7c3b537..5d08d133 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -37,7 +37,18 @@ namespace LibGit2Sharp private readonly Lazy pathCase; /// - /// Initializes a new instance of the class, providing ooptional behavioral overrides through parameter. + /// Initializes a new instance of the class. + /// For a standard repository, should either point to the ".git" folder or to the working directory. For a bare repository, should directly point to the repository folder. + /// + /// + /// The path to the git repository to open, can be either the path to the git directory (for non-bare repositories this + /// would be the ".git" folder inside the working directory) or the path to the working directory. + /// + public Repository(string path) : this(path, null) + { } + + /// + /// Initializes a new instance of the class, providing optional behavioral overrides through parameter. /// For a standard repository, should either point to the ".git" folder or to the working directory. For a bare repository, should directly point to the repository folder. /// /// @@ -47,7 +58,7 @@ namespace LibGit2Sharp /// /// Overrides to the way a repository is opened. /// - public Repository(string path, RepositoryOptions options = null) + public Repository(string path, RepositoryOptions options) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); @@ -365,13 +376,23 @@ namespace LibGit2Sharp #endregion + /// + /// Initialize a repository at the specified . + /// + /// The path to the working folder when initializing a standard ".git" repository. Otherwise, when initializing a bare repository, the path to the expected location of this later. + /// The path to the created repository. + public static string Init(string path) + { + return Init(path, false); + } + /// /// Initialize a repository at the specified . /// /// The path to the working folder when initializing a standard ".git" repository. Otherwise, when initializing a bare repository, the path to the expected location of this later. /// true to initialize a bare repository. False otherwise, to initialize a standard ".git" repository. /// The path to the created repository. - public static string Init(string path, bool isBare = false) + public static string Init(string path, bool isBare) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); @@ -542,6 +563,24 @@ namespace LibGit2Sharp return discoveredPath.Native; } + /// + /// Clone using default options. + /// + /// This exception is thrown when there + /// is an error is encountered while recursively cloning submodules. The inner exception + /// will contain the original exception. The initially cloned repository would + /// be reported through the + /// property." + /// Exception thrown when the cancelling + /// the clone of the initial repository." + /// URI for the remote repository + /// Local path to clone into + /// The path to the created repository. + public static string Clone(string sourceUrl, string workdirPath) + { + return Clone(sourceUrl, workdirPath, null); + } + /// /// Clone with specified options. /// @@ -557,7 +596,7 @@ namespace LibGit2Sharp /// controlling clone behavior /// The path to the created repository. public static string Clone(string sourceUrl, string workdirPath, - CloneOptions options = null) + CloneOptions options) { Ensure.ArgumentNotNull(sourceUrl, "sourceUrl"); Ensure.ArgumentNotNull(workdirPath, "workdirPath"); -- cgit v1.2.3 From cb9ebe5e6e4a7ba00a690cd3237793bf2cf514d5 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:52:13 +0200 Subject: Drop optional parameters in RemoteCollection.cs --- LibGit2Sharp/RemoteCollection.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LibGit2Sharp/RemoteCollection.cs b/LibGit2Sharp/RemoteCollection.cs index b0eb584a..d504ca3c 100644 --- a/LibGit2Sharp/RemoteCollection.cs +++ b/LibGit2Sharp/RemoteCollection.cs @@ -140,6 +140,17 @@ namespace LibGit2Sharp Proxy.git_remote_delete(repository.Handle, name); } + /// + /// Renames an existing . + /// + /// The current remote name. + /// The new name the existing remote should bear. + /// A new . + public virtual Remote Rename(string name, string newName) + { + return Rename(name, newName, null); + } + /// /// Renames an existing . /// @@ -147,7 +158,7 @@ namespace LibGit2Sharp /// The new name the existing remote should bear. /// The callback to be used when problems with renaming occur. (e.g. non-default fetch refspecs) /// A new . - public virtual Remote Rename(string name, string newName, RemoteRenameFailureHandler callback = null) + public virtual Remote Rename(string name, string newName, RemoteRenameFailureHandler callback) { Ensure.ArgumentNotNull(name, "name"); Ensure.ArgumentNotNull(newName, "newName"); -- cgit v1.2.3 From 0a030f892050ee6892eefc64610945bf36803799 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:52:40 +0200 Subject: Drop optional parameters in ReferenceCollectionExtensions.cs --- LibGit2Sharp/ReferenceCollection.cs | 81 ++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/LibGit2Sharp/ReferenceCollection.cs b/LibGit2Sharp/ReferenceCollection.cs index e3dc68c8..ce0ed957 100644 --- a/LibGit2Sharp/ReferenceCollection.cs +++ b/LibGit2Sharp/ReferenceCollection.cs @@ -66,6 +66,18 @@ namespace LibGit2Sharp #endregion + /// + /// Creates a direct reference with the specified name and target + /// + /// The canonical name of the reference to create. + /// Id of the target object. + /// The optional message to log in the when adding the + /// A new . + public virtual DirectReference Add(string name, ObjectId targetId, string logMessage) + { + return Add(name, targetId, logMessage, false); + } + /// /// Creates a direct reference with the specified name and target /// @@ -74,7 +86,7 @@ namespace LibGit2Sharp /// The optional message to log in the when adding the /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual DirectReference Add(string name, ObjectId targetId, string logMessage, bool allowOverwrite = false) + public virtual DirectReference Add(string name, ObjectId targetId, string logMessage, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(targetId, "targetId"); @@ -85,6 +97,17 @@ namespace LibGit2Sharp } } + /// + /// Creates a direct reference with the specified name and target + /// + /// The canonical name of the reference to create. + /// Id of the target object. + /// A new . + public virtual DirectReference Add(string name, ObjectId targetId) + { + return Add(name, targetId, null, false); + } + /// /// Creates a direct reference with the specified name and target /// @@ -92,11 +115,23 @@ namespace LibGit2Sharp /// Id of the target object. /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual DirectReference Add(string name, ObjectId targetId, bool allowOverwrite = false) + public virtual DirectReference Add(string name, ObjectId targetId, bool allowOverwrite) { return Add(name, targetId, null, allowOverwrite); } + /// + /// Creates a symbolic reference with the specified name and target + /// + /// The canonical name of the reference to create. + /// The target reference. + /// The optional message to log in the when adding the + /// A new . + public virtual SymbolicReference Add(string name, Reference targetRef, string logMessage) + { + return Add(name, targetRef, logMessage, false); + } + /// /// Creates a symbolic reference with the specified name and target /// @@ -105,7 +140,7 @@ namespace LibGit2Sharp /// The optional message to log in the when adding the /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual SymbolicReference Add(string name, Reference targetRef, string logMessage, bool allowOverwrite = false) + public virtual SymbolicReference Add(string name, Reference targetRef, string logMessage, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(targetRef, "targetRef"); @@ -117,6 +152,17 @@ namespace LibGit2Sharp } } + /// + /// Creates a symbolic reference with the specified name and target + /// + /// The canonical name of the reference to create. + /// The target reference. + /// A new . + public virtual SymbolicReference Add(string name, Reference targetRef) + { + return Add(name, targetRef, null, false); + } + /// /// Creates a symbolic reference with the specified name and target /// @@ -124,7 +170,7 @@ namespace LibGit2Sharp /// The target reference. /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual SymbolicReference Add(string name, Reference targetRef, bool allowOverwrite = false) + public virtual SymbolicReference Add(string name, Reference targetRef, bool allowOverwrite) { return Add(name, targetRef, null, allowOverwrite); } @@ -140,6 +186,18 @@ namespace LibGit2Sharp Proxy.git_reference_remove(repo.Handle, reference.CanonicalName); } + /// + /// Rename an existing reference with a new name, and update the reflog + /// + /// The reference to rename. + /// The new canonical name. + /// Message added to the reflog. + /// A new . + public virtual Reference Rename(Reference reference, string newName, string logMessage) + { + return Rename(reference, newName, logMessage, false); + } + /// /// Rename an existing reference with a new name, and update the reflog /// @@ -148,7 +206,7 @@ namespace LibGit2Sharp /// Message added to the reflog. /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual Reference Rename(Reference reference, string newName, string logMessage = null, bool allowOverwrite = false) + public virtual Reference Rename(Reference reference, string newName, string logMessage, bool allowOverwrite) { Ensure.ArgumentNotNull(reference, "reference"); Ensure.ArgumentNotNullOrEmptyString(newName, "newName"); @@ -166,6 +224,17 @@ namespace LibGit2Sharp } } + /// + /// Rename an existing reference with a new name + /// + /// The reference to rename. + /// The new canonical name. + /// A new . + public virtual Reference Rename(Reference reference, string newName) + { + return Rename(reference, newName, null, false); + } + /// /// Rename an existing reference with a new name /// @@ -173,7 +242,7 @@ namespace LibGit2Sharp /// The new canonical name. /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public virtual Reference Rename(Reference reference, string newName, bool allowOverwrite = false) + public virtual Reference Rename(Reference reference, string newName, bool allowOverwrite) { return Rename(reference, newName, null, allowOverwrite); } -- cgit v1.2.3 From 1bb9d428b08a1742d85281d675fa49fff396751f Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:53:40 +0200 Subject: Drop optional parameters in ObjectDatabase.cs --- LibGit2Sharp/ObjectDatabase.cs | 79 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/LibGit2Sharp/ObjectDatabase.cs b/LibGit2Sharp/ObjectDatabase.cs index 5ec2729d..73bd5e9b 100644 --- a/LibGit2Sharp/ObjectDatabase.cs +++ b/LibGit2Sharp/ObjectDatabase.cs @@ -75,7 +75,7 @@ namespace LibGit2Sharp /// /// Retrieves the header of a GitObject from the object database. The header contains the Size /// and Type of the object. Note that most backends do not support reading only the header - /// of an object, so the whole object will be read and then size would be returned. + /// of an object, so the whole object will be read and then size would be returned. /// /// Object Id of the queried object /// GitObjectMetadata object instance containg object header information @@ -177,6 +177,29 @@ namespace LibGit2Sharp } } + /// + /// Inserts a into the object database, created from the content of a stream. + /// Optionally, git filters will be applied to the content before storing it. + /// + /// The stream from which will be read the content of the blob to be created. + /// The created . + public virtual Blob CreateBlob(Stream stream) + { + return CreateBlob(stream, null, null); + } + + /// + /// Inserts a into the object database, created from the content of a stream. + /// Optionally, git filters will be applied to the content before storing it. + /// + /// The stream from which will be read the content of the blob to be created. + /// The hintpath is used to determine what git filters should be applied to the object before it can be placed to the object database. + /// The created . + public virtual Blob CreateBlob(Stream stream, string hintpath) + { + return CreateBlob(stream, hintpath, null); + } + /// /// Inserts a into the object database, created from the content of a stream. /// Optionally, git filters will be applied to the content before storing it. @@ -185,7 +208,12 @@ namespace LibGit2Sharp /// The hintpath is used to determine what git filters should be applied to the object before it can be placed to the object database. /// The number of bytes to consume from the stream. /// The created . - public virtual Blob CreateBlob(Stream stream, string hintpath = null, int? numberOfBytesToConsume = null) + public virtual Blob CreateBlob(Stream stream, string hintpath, int numberOfBytesToConsume) + { + return CreateBlob(stream, hintpath, (int?)numberOfBytesToConsume); + } + + internal Blob CreateBlob(Stream stream, string hintpath, int? numberOfBytesToConsume) { Ensure.ArgumentNotNull(stream, "stream"); @@ -295,9 +323,32 @@ namespace LibGit2Sharp /// The of the to be created. /// The parents of the to be created. /// True to prettify the message, or false to leave it as is. - /// Character that lines start with to be stripped if prettifyMessage is true. /// The created . - public virtual Commit CreateCommit(Signature author, Signature committer, string message, Tree tree, IEnumerable parents, bool prettifyMessage, char? commentChar = null) + public virtual Commit CreateCommit(Signature author, Signature committer, string message, Tree tree, IEnumerable parents, bool prettifyMessage) + { + return CreateCommit(author, committer, message, tree, parents, prettifyMessage, null); + } + + /// + /// Inserts a into the object database, referencing an existing . + /// + /// Prettifing the message includes: + /// * Removing empty lines from the beginning and end. + /// * Removing trailing spaces from every line. + /// * Turning multiple consecutive empty lines between paragraphs into just one empty line. + /// * Ensuring the commit message ends with a newline. + /// * Removing every line starting with the . + /// + /// + /// The of who made the change. + /// The of who added the change to the repository. + /// The description of why a change was made to the repository. + /// The of the to be created. + /// The parents of the to be created. + /// True to prettify the message, or false to leave it as is. + /// When non null, lines starting with this character will be stripped if prettifyMessage is true. + /// The created . + public virtual Commit CreateCommit(Signature author, Signature committer, string message, Tree tree, IEnumerable parents, bool prettifyMessage, char? commentChar) { Ensure.ArgumentNotNull(message, "message"); Ensure.ArgumentDoesNotContainZeroByte(message, "message"); @@ -382,6 +433,18 @@ namespace LibGit2Sharp return new HistoryDivergence(repo, one, another); } + /// + /// Calculates the current shortest abbreviated + /// string representation for a . + /// + /// The which identifier should be shortened. + /// A short string representation of the . + public virtual string ShortenObjectId(GitObject gitObject) + { + var shortSha = Proxy.git_object_short_id(repo.Handle, gitObject.Id); + return shortSha; + } + /// /// Calculates the current shortest abbreviated /// string representation for a . @@ -389,9 +452,9 @@ namespace LibGit2Sharp /// The which identifier should be shortened. /// Minimum length of the shortened representation. /// A short string representation of the . - public virtual string ShortenObjectId(GitObject gitObject, int? minLength = null) + public virtual string ShortenObjectId(GitObject gitObject, int minLength) { - if (minLength.HasValue && (minLength <= 0 || minLength > ObjectId.HexSize)) + if (minLength <= 0 || minLength > ObjectId.HexSize) { throw new ArgumentOutOfRangeException("minLength", minLength, string.Format("Expected value should be greater than zero and less than or equal to {0}.", ObjectId.HexSize)); @@ -399,12 +462,12 @@ namespace LibGit2Sharp string shortSha = Proxy.git_object_short_id(repo.Handle, gitObject.Id); - if (minLength == null || (minLength <= shortSha.Length)) + if (minLength <= shortSha.Length) { return shortSha; } - return gitObject.Sha.Substring(0, minLength.Value); + return gitObject.Sha.Substring(0, minLength); } /// -- cgit v1.2.3 From d16fbec108572d20f142127aba6c31f17074f932 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:54:15 +0200 Subject: Drop optional parameters in TagCollectionExtensions.cs --- LibGit2Sharp/TagCollectionExtensions.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/TagCollectionExtensions.cs b/LibGit2Sharp/TagCollectionExtensions.cs index f976e65e..20ad5305 100644 --- a/LibGit2Sharp/TagCollectionExtensions.cs +++ b/LibGit2Sharp/TagCollectionExtensions.cs @@ -7,6 +7,19 @@ namespace LibGit2Sharp /// public static class TagCollectionExtensions { + /// + /// Creates an annotated tag with the specified name. + /// + /// The name. + /// Revparse spec for the target object. + /// The tagger. + /// The message. + /// The being worked with. + public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message) + { + return tags.Add(name, objectish, tagger, message, false); + } + /// /// Creates an annotated tag with the specified name. /// @@ -16,7 +29,7 @@ namespace LibGit2Sharp /// The message. /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The being worked with. - public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message, bool allowOverwrite = false) + public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(objectish, "target"); @@ -25,6 +38,17 @@ namespace LibGit2Sharp return tags.Add(name, objectToTag, tagger, message, allowOverwrite); } + /// + /// Creates a lightweight tag with the specified name. + /// + /// The name. + /// Revparse spec for the target object. + /// The being worked with. + public static Tag Add(this TagCollection tags, string name, string objectish) + { + return tags.Add(name, objectish, false); + } + /// /// Creates a lightweight tag with the specified name. /// @@ -32,7 +56,7 @@ namespace LibGit2Sharp /// Revparse spec for the target object. /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The being worked with. - public static Tag Add(this TagCollection tags, string name, string objectish, bool allowOverwrite = false) + public static Tag Add(this TagCollection tags, string name, string objectish, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(objectish, "objectish"); -- cgit v1.2.3 From bce3f4c1320ebd5b72a40d8bc4ce7954ab8d37ee Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 11:54:45 +0200 Subject: Drop optional parameters in ReferenceCollectionExtensions.cs --- LibGit2Sharp/ReferenceCollectionExtensions.cs | 73 +++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/LibGit2Sharp/ReferenceCollectionExtensions.cs b/LibGit2Sharp/ReferenceCollectionExtensions.cs index 423397cc..5fb2f6dd 100644 --- a/LibGit2Sharp/ReferenceCollectionExtensions.cs +++ b/LibGit2Sharp/ReferenceCollectionExtensions.cs @@ -32,6 +32,20 @@ namespace LibGit2Sharp return reference != null ? RefState.Exists : RefState.DoesNotExistButLooksValid; } + /// + /// Creates a direct or symbolic reference with the specified name and target + /// + /// The being worked with. + /// The name of the reference to create. + /// The target which can be either the canonical name of a reference or a revparse spec. + /// The optional message to log in the when adding the + /// A new . + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, + string logMessage) + { + return refsColl.Add(name, canonicalRefNameOrObjectish, logMessage, false); + } + /// /// Creates a direct or symbolic reference with the specified name and target /// @@ -41,7 +55,7 @@ namespace LibGit2Sharp /// The optional message to log in the when adding the /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, string logMessage, bool allowOverwrite = false) + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, string logMessage, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(canonicalRefNameOrObjectish, "canonicalRefNameOrObjectish"); @@ -77,6 +91,19 @@ namespace LibGit2Sharp return refsColl.Add(name, gitObject.Id, logMessage, allowOverwrite); } + + /// + /// Creates a direct or symbolic reference with the specified name and target + /// + /// The being worked with. + /// The name of the reference to create. + /// The target which can be either the canonical name of a reference or a revparse spec. + /// A new . + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish) + { + return Add(refsColl, name, canonicalRefNameOrObjectish, null, false); + } + /// /// Creates a direct or symbolic reference with the specified name and target /// @@ -85,7 +112,7 @@ namespace LibGit2Sharp /// The target which can be either the canonical name of a reference or a revparse spec. /// True to allow silent overwriting a potentially existing reference, false otherwise. /// A new . - public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, bool allowOverwrite = false) + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, bool allowOverwrite) { return Add(refsColl, name, canonicalRefNameOrObjectish, null, allowOverwrite); } @@ -122,6 +149,46 @@ namespace LibGit2Sharp return UpdateTarget(refsColl, directRef, objectish, null); } + /// + /// Rename an existing reference with a new name + /// + /// The canonical name of the reference to rename. + /// The new canonical name. + /// The being worked with. + /// A new . + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName) + { + return refsColl.Rename(currentName, newName, null, false); + } + + /// + /// Rename an existing reference with a new name + /// + /// The canonical name of the reference to rename. + /// The new canonical name. + /// True to allow silent overwriting a potentially existing reference, false otherwise. + /// The being worked with. + /// A new . + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName, + bool allowOverwrite) + { + return refsColl.Rename(currentName, newName, null, allowOverwrite); + } + + /// + /// Rename an existing reference with a new name + /// + /// The canonical name of the reference to rename. + /// The new canonical name. + /// The optional message to log in the + /// The being worked with. + /// A new . + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName, + string logMessage) + { + return refsColl.Rename(currentName, newName, logMessage, false); + } + /// /// Rename an existing reference with a new name /// @@ -132,7 +199,7 @@ namespace LibGit2Sharp /// The being worked with. /// A new . public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName, - string logMessage = null, bool allowOverwrite = false) + string logMessage, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(currentName, "currentName"); -- cgit v1.2.3 From 631b36c995813aa90d790d8f40e342681f443112 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 12:56:45 +0200 Subject: Drop optional parameters in NetworkExtensions.cs --- LibGit2Sharp/NetworkExtensions.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/NetworkExtensions.cs b/LibGit2Sharp/NetworkExtensions.cs index cf769c95..4efc53f0 100644 --- a/LibGit2Sharp/NetworkExtensions.cs +++ b/LibGit2Sharp/NetworkExtensions.cs @@ -9,6 +9,18 @@ namespace LibGit2Sharp /// public static class NetworkExtensions { + /// + /// Push the specified branch to its tracked branch on the remote. + /// + /// The being worked with. + /// The branch to push. + /// Throws if either the Remote or the UpstreamBranchCanonicalName is not set. + public static void Push( + this Network network, + Branch branch) + { + network.Push(new[] { branch }); + } /// /// Push the specified branch to its tracked branch on the remote. /// @@ -19,11 +31,24 @@ namespace LibGit2Sharp public static void Push( this Network network, Branch branch, - PushOptions pushOptions = null) + PushOptions pushOptions) { network.Push(new[] { branch }, pushOptions); } + /// + /// Push the specified branches to their tracked branches on the remote. + /// + /// The being worked with. + /// The branches to push. + /// Throws if either the Remote or the UpstreamBranchCanonicalName is not set. + public static void Push( + this Network network, + IEnumerable branches) + { + network.Push(branches, null); + } + /// /// Push the specified branches to their tracked branches on the remote. /// @@ -34,7 +59,7 @@ namespace LibGit2Sharp public static void Push( this Network network, IEnumerable branches, - PushOptions pushOptions = null) + PushOptions pushOptions) { var enumeratedBranches = branches as IList ?? branches.ToList(); -- cgit v1.2.3 From 427755989df0b1c69e58affa402ef2b5d4ce6bc6 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 12:57:28 +0200 Subject: Drop optional parameters in ConfigurationExtensions.cs --- LibGit2Sharp/ConfigurationExtensions.cs | 67 +++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/LibGit2Sharp/ConfigurationExtensions.cs b/LibGit2Sharp/ConfigurationExtensions.cs index 5e79a289..1ffd7159 100644 --- a/LibGit2Sharp/ConfigurationExtensions.cs +++ b/LibGit2Sharp/ConfigurationExtensions.cs @@ -68,6 +68,18 @@ namespace LibGit2Sharp return config.Get(new[] { firstKeyPart, secondKeyPart, thirdKeyPart }); } + /// + /// Get a configuration value for the given key. + /// + /// The configuration value type. + /// The configuration being worked with. + /// The key + /// The configuration value, or the default value for the selected if not found + public static T GetValueOrDefault(this Configuration config, string key) + { + return ValueOrDefault(config.Get(key), default(T)); + } + /// /// Get a configuration value for the given key, /// or if the key is not set. @@ -76,27 +88,52 @@ namespace LibGit2Sharp /// The configuration being worked with. /// The key /// The default value if the key is not set. - /// The configuration value, or the default. - public static T GetValueOrDefault(this Configuration config, string key, T defaultValue = default(T)) + /// The configuration value, or the default value + public static T GetValueOrDefault(this Configuration config, string key, T defaultValue) { return ValueOrDefault(config.Get(key), defaultValue); } + /// + /// Get a configuration value for the given key + /// + /// The configuration value type. + /// The configuration being worked with. + /// The key. + /// The configuration file into which the key should be searched for. + /// The configuration value, or the default value for if not found + public static T GetValueOrDefault(this Configuration config, string key, ConfigurationLevel level) + { + return ValueOrDefault(config.Get(key, level), default(T)); + } + /// /// Get a configuration value for the given key, /// or if the key is not set. /// /// The configuration value type. - /// The configuration being worked with. + /// The configuration being worked with. /// The key. /// The configuration file into which the key should be searched for. /// The selector used to generate a default value if the key is not set. - /// The configuration value, or the default. - public static T GetValueOrDefault(this Configuration config, string key, ConfigurationLevel level, T defaultValue = default(T)) + /// The configuration value, or the default value. + public static T GetValueOrDefault(this Configuration config, string key, ConfigurationLevel level, T defaultValue) { return ValueOrDefault(config.Get(key, level), defaultValue); } + /// + /// Get a configuration value for the given key parts + /// + /// The configuration value type. + /// The configuration being worked with. + /// The key parts. + /// The configuration value, or the default value for if not found + public static T GetValueOrDefault(this Configuration config, string[] keyParts) + { + return ValueOrDefault(config.Get(keyParts), default(T)); + } + /// /// Get a configuration value for the given key parts, /// or if the key is not set. @@ -105,12 +142,26 @@ namespace LibGit2Sharp /// The configuration being worked with. /// The key parts. /// The default value if the key is not set. - /// The configuration value, or the default. - public static T GetValueOrDefault(this Configuration config, string[] keyParts, T defaultValue = default(T)) + /// The configuration value, or the default value. + public static T GetValueOrDefault(this Configuration config, string[] keyParts, T defaultValue) { return ValueOrDefault(config.Get(keyParts), defaultValue); } + /// + /// Get a configuration value for the given key parts. + /// + /// The configuration value type. + /// The configuration being worked with. + /// The first key part. + /// The second key part. + /// The third key part. + /// The configuration value, or the default value for the selected if not found + public static T GetValueOrDefault(this Configuration config, string firstKeyPart, string secondKeyPart, string thirdKeyPart) + { + return ValueOrDefault(config.Get(firstKeyPart, secondKeyPart, thirdKeyPart), default(T)); + } + /// /// Get a configuration value for the given key parts, /// or if the key is not set. @@ -122,7 +173,7 @@ namespace LibGit2Sharp /// The third key part. /// The default value if the key is not set. /// The configuration value, or the default. - public static T GetValueOrDefault(this Configuration config, string firstKeyPart, string secondKeyPart, string thirdKeyPart, T defaultValue = default(T)) + public static T GetValueOrDefault(this Configuration config, string firstKeyPart, string secondKeyPart, string thirdKeyPart, T defaultValue) { return ValueOrDefault(config.Get(firstKeyPart, secondKeyPart, thirdKeyPart), defaultValue); } -- cgit v1.2.3 From 9b26f363ad86509bbea697c9ac7bddba8e16c0c0 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 12:58:18 +0200 Subject: Drop optional parameters in Configuration.cs --- LibGit2Sharp.Tests/ConfigurationFixture.cs | 2 +- LibGit2Sharp/Configuration.cs | 66 +++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/LibGit2Sharp.Tests/ConfigurationFixture.cs b/LibGit2Sharp.Tests/ConfigurationFixture.cs index 4f92ce0c..78cb71c0 100644 --- a/LibGit2Sharp.Tests/ConfigurationFixture.cs +++ b/LibGit2Sharp.Tests/ConfigurationFixture.cs @@ -256,7 +256,7 @@ namespace LibGit2Sharp.Tests [Fact] public void SettingLocalConfigurationOutsideAReposThrows() { - using (var config = new Configuration()) + using (var config = new Configuration(null, null, null)) { Assert.Throws(() => config.Set("unittests.intsetting", 3)); } diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs index b1b57456..078ad14f 100644 --- a/LibGit2Sharp/Configuration.cs +++ b/LibGit2Sharp/Configuration.cs @@ -73,13 +73,30 @@ namespace LibGit2Sharp } } + /// + /// Access configuration values without a repository. Generally you want to access configuration via an instance of instead. + /// + /// Path to a Global configuration file. If null, the default path for a global configuration file will be probed. + public Configuration(string globalConfigurationFileLocation) + : this(null, globalConfigurationFileLocation, null, null) + { } + + /// + /// Access configuration values without a repository. Generally you want to access configuration via an instance of instead. + /// + /// Path to a Global configuration file. If null, the default path for a global configuration file will be probed. + /// Path to a XDG configuration file. If null, the default path for a XDG configuration file will be probed. + public Configuration(string globalConfigurationFileLocation, string xdgConfigurationFileLocation) + : this(null, globalConfigurationFileLocation, xdgConfigurationFileLocation, null) + { } + /// /// Access configuration values without a repository. Generally you want to access configuration via an instance of instead. /// /// Path to a Global configuration file. If null, the default path for a global configuration file will be probed. /// Path to a XDG configuration file. If null, the default path for a XDG configuration file will be probed. /// Path to a System configuration file. If null, the default path for a system configuration file will be probed. - public Configuration(string globalConfigurationFileLocation = null, string xdgConfigurationFileLocation = null, string systemConfigurationFileLocation = null) + public Configuration(string globalConfigurationFileLocation, string xdgConfigurationFileLocation, string systemConfigurationFileLocation) : this(null, globalConfigurationFileLocation, xdgConfigurationFileLocation, systemConfigurationFileLocation) { } @@ -110,12 +127,21 @@ namespace LibGit2Sharp #endregion + /// + /// Unset a configuration variable (key and value) in the local configuration. + /// + /// The key to unset. + public virtual void Unset(string key) + { + Unset(key, ConfigurationLevel.Local); + } + /// /// Unset a configuration variable (key and value). /// /// The key to unset. /// The configuration file which should be considered as the target of this operation - public virtual void Unset(string key, ConfigurationLevel level = ConfigurationLevel.Local) + public virtual void Unset(string key, ConfigurationLevel level) { Ensure.ArgumentNotNullOrEmptyString(key, "key"); @@ -209,6 +235,27 @@ namespace LibGit2Sharp } } + /// + /// Set a configuration value for a key in the local configuration. Keys are in the form 'section.name'. + /// + /// For example in order to set the value for this in a .git\config file: + /// + /// [test] + /// boolsetting = true + /// + /// You would call: + /// + /// repo.Config.Set("test.boolsetting", true); + /// + /// + /// The configuration value type + /// The key parts + /// The value + public virtual void Set(string key, T value) + { + Set(key, value, ConfigurationLevel.Local); + } + /// /// Set a configuration value for a key. Keys are in the form 'section.name'. /// @@ -226,7 +273,7 @@ namespace LibGit2Sharp /// The key parts /// The value /// The configuration file which should be considered as the target of this operation - public virtual void Set(string key, T value, ConfigurationLevel level = ConfigurationLevel.Local) + public virtual void Set(string key, T value, ConfigurationLevel level) { Ensure.ArgumentNotNull(value, "value"); Ensure.ArgumentNotNullOrEmptyString(key, "key"); @@ -242,14 +289,23 @@ namespace LibGit2Sharp } } + /// + /// Find configuration entries matching . + /// + /// A regular expression. + /// Matching entries. + public virtual IEnumerable> Find(string regexp) + { + return Find(regexp, ConfigurationLevel.Local); + } + /// /// Find configuration entries matching . /// /// A regular expression. /// The configuration file into which the key should be searched for. /// Matching entries. - public virtual IEnumerable> Find(string regexp, - ConfigurationLevel level = ConfigurationLevel.Local) + public virtual IEnumerable> Find(string regexp, ConfigurationLevel level) { Ensure.ArgumentNotNullOrEmptyString(regexp, "regexp"); -- cgit v1.2.3 From 1f9d9ddb2b7b2591a9109eb42b9dca222333417d Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 12:59:07 +0200 Subject: Drop optional parameters in StashCollection.cs --- LibGit2Sharp/StashCollection.cs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/LibGit2Sharp/StashCollection.cs b/LibGit2Sharp/StashCollection.cs index ffe137a5..1bc509a2 100644 --- a/LibGit2Sharp/StashCollection.cs +++ b/LibGit2Sharp/StashCollection.cs @@ -76,6 +76,37 @@ namespace LibGit2Sharp } } + /// + /// Creates a stash with the specified message. + /// + /// The of the user who stashes + /// the newly created + public virtual Stash Add(Signature stasher) + { + return Add(stasher, null, StashModifiers.Default); + } + /// + /// Creates a stash with the specified message. + /// + /// The of the user who stashes + /// A combination of flags + /// the newly created + public virtual Stash Add(Signature stasher, StashModifiers options) + { + return Add(stasher, null, options); + } + + /// + /// Creates a stash with the specified message. + /// + /// The of the user who stashes + /// The message of the stash. + /// the newly created + public virtual Stash Add(Signature stasher, string message) + { + return Add(stasher, message, StashModifiers.Default); + } + /// /// Creates a stash with the specified message. /// @@ -83,7 +114,7 @@ namespace LibGit2Sharp /// The message of the stash. /// A combination of flags /// the newly created - public virtual Stash Add(Signature stasher, string message = null, StashModifiers options = StashModifiers.Default) + public virtual Stash Add(Signature stasher, string message, StashModifiers options) { Ensure.ArgumentNotNull(stasher, "stasher"); -- cgit v1.2.3 From 0cfa9230e00d340805223a81a165769fb72a744c Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 12:59:39 +0200 Subject: Drop optional parameters in Network.cs --- LibGit2Sharp/Network.cs | 186 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 171 insertions(+), 15 deletions(-) diff --git a/LibGit2Sharp/Network.cs b/LibGit2Sharp/Network.cs index 49d80d3d..a0216f9b 100644 --- a/LibGit2Sharp/Network.cs +++ b/LibGit2Sharp/Network.cs @@ -46,9 +46,25 @@ namespace LibGit2Sharp /// /// /// The to list from. - /// The optional used to connect to remote repository. /// The references in the repository. - public virtual IEnumerable ListReferences(Remote remote, CredentialsHandler credentialsProvider = null) + public virtual IEnumerable ListReferences(Remote remote) + { + return ListReferences(remote, null); + } + + /// + /// List references in a repository. + /// + /// When the remote tips are ahead of the local ones, the retrieved + /// s may point to non existing + /// s in the local repository. In that + /// case, will return null. + /// + /// + /// The to list from. + /// The used to connect to remote repository. + /// The references in the repository. + public virtual IEnumerable ListReferences(Remote remote, CredentialsHandler credentialsProvider) { Ensure.ArgumentNotNull(remote, "remote"); @@ -116,14 +132,42 @@ namespace LibGit2Sharp Proxy.git_remote_fetch(remoteHandle, logMessage); } + /// + /// Fetch from the . + /// + /// The remote to fetch + public virtual void Fetch(Remote remote) + { + Fetch(remote, (FetchOptions)null, null); + } + + /// + /// Fetch from the . + /// + /// The remote to fetch + /// controlling fetch behavior + public virtual void Fetch(Remote remote, FetchOptions options) + { + Fetch(remote, options, null); + } + + /// + /// Fetch from the . + /// + /// The remote to fetch + /// Message to use when updating the reflog. + public virtual void Fetch(Remote remote, string logMessage) + { + Fetch(remote, (FetchOptions)null, logMessage); + } + /// /// Fetch from the . /// /// The remote to fetch /// controlling fetch behavior /// Message to use when updating the reflog. - public virtual void Fetch(Remote remote, FetchOptions options = null, - string logMessage = null) + public virtual void Fetch(Remote remote, FetchOptions options, string logMessage) { Ensure.ArgumentNotNull(remote, "remote"); @@ -133,6 +177,38 @@ namespace LibGit2Sharp } } + /// + /// Fetch from the , using custom refspecs. + /// + /// The remote to fetch + /// Refspecs to use, replacing the remote's fetch refspecs + public virtual void Fetch(Remote remote, IEnumerable refspecs) + { + Fetch(remote, refspecs, null, null); + } + + /// + /// Fetch from the , using custom refspecs. + /// + /// The remote to fetch + /// Refspecs to use, replacing the remote's fetch refspecs + /// controlling fetch behavior + public virtual void Fetch(Remote remote, IEnumerable refspecs, FetchOptions options) + { + Fetch(remote, refspecs, options, null); + } + + /// + /// Fetch from the , using custom refspecs. + /// + /// The remote to fetch + /// Refspecs to use, replacing the remote's fetch refspecs + /// Message to use when updating the reflog. + public virtual void Fetch(Remote remote, IEnumerable refspecs, string logMessage) + { + Fetch(remote, refspecs, null, logMessage); + } + /// /// Fetch from the , using custom refspecs. /// @@ -140,8 +216,7 @@ namespace LibGit2Sharp /// Refspecs to use, replacing the remote's fetch refspecs /// controlling fetch behavior /// Message to use when updating the reflog. - public virtual void Fetch(Remote remote, IEnumerable refspecs, FetchOptions options = null, - string logMessage = null) + public virtual void Fetch(Remote remote, IEnumerable refspecs, FetchOptions options, string logMessage) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(refspecs, "refspecs"); @@ -154,6 +229,46 @@ namespace LibGit2Sharp } } + /// + /// Fetch from a url with a set of fetch refspecs + /// + /// The url to fetch from + /// The list of resfpecs to use + public virtual void Fetch( + string url, + IEnumerable refspecs) + { + Fetch(url, refspecs, null, null); + } + + /// + /// Fetch from a url with a set of fetch refspecs + /// + /// The url to fetch from + /// The list of resfpecs to use + /// controlling fetch behavior + public virtual void Fetch( + string url, + IEnumerable refspecs, + FetchOptions options) + { + Fetch(url, refspecs, options, null); + } + + /// + /// Fetch from a url with a set of fetch refspecs + /// + /// The url to fetch from + /// The list of resfpecs to use + /// Message to use when updating the reflog. + public virtual void Fetch( + string url, + IEnumerable refspecs, + string logMessage) + { + Fetch(url, refspecs, null, logMessage); + } + /// /// Fetch from a url with a set of fetch refspecs /// @@ -164,8 +279,8 @@ namespace LibGit2Sharp public virtual void Fetch( string url, IEnumerable refspecs, - FetchOptions options = null, - string logMessage = null) + FetchOptions options, + string logMessage) { Ensure.ArgumentNotNull(url, "url"); Ensure.ArgumentNotNull(refspecs, "refspecs"); @@ -178,6 +293,24 @@ namespace LibGit2Sharp } } + /// + /// Push the objectish to the destination reference on the . + /// + /// The to push to. + /// The source objectish to push. + /// The reference to update on the remote. + public virtual void Push( + Remote remote, + string objectish, + string destinationSpec) + { + Ensure.ArgumentNotNull(objectish, "objectish"); + Ensure.ArgumentNotNullOrEmptyString(destinationSpec, "destinationSpec"); + + Push(remote, string.Format(CultureInfo.InvariantCulture, + "{0}:{1}", objectish, destinationSpec)); + } + /// /// Push the objectish to the destination reference on the . /// @@ -189,16 +322,28 @@ namespace LibGit2Sharp Remote remote, string objectish, string destinationSpec, - PushOptions pushOptions = null) + PushOptions pushOptions) { - Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(objectish, "objectish"); - Ensure.ArgumentNotNullOrEmptyString(destinationSpec, destinationSpec); + Ensure.ArgumentNotNullOrEmptyString(destinationSpec, "destinationSpec"); Push(remote, string.Format(CultureInfo.InvariantCulture, "{0}:{1}", objectish, destinationSpec), pushOptions); } + /// + /// Push specified reference to the . + /// + /// The to push to. + /// The pushRefSpec to push. + public virtual void Push( + Remote remote, + string pushRefSpec) + { + Ensure.ArgumentNotNullOrEmptyString(pushRefSpec, "pushRefSpec"); + + Push(remote, new[] { pushRefSpec }); + } /// /// Push specified reference to the . /// @@ -208,14 +353,25 @@ namespace LibGit2Sharp public virtual void Push( Remote remote, string pushRefSpec, - PushOptions pushOptions = null) + PushOptions pushOptions) { - Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNullOrEmptyString(pushRefSpec, "pushRefSpec"); Push(remote, new[] { pushRefSpec }, pushOptions); } + /// + /// Push specified references to the . + /// + /// The to push to. + /// The pushRefSpecs to push. + public virtual void Push( + Remote remote, + IEnumerable pushRefSpecs) + { + Push(remote, pushRefSpecs, null); + } + /// /// Push specified references to the . /// @@ -225,7 +381,7 @@ namespace LibGit2Sharp public virtual void Push( Remote remote, IEnumerable pushRefSpecs, - PushOptions pushOptions = null) + PushOptions pushOptions) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(pushRefSpecs, "pushRefSpecs"); @@ -276,7 +432,7 @@ namespace LibGit2Sharp Branch currentBranch = repository.Head; - if(!currentBranch.IsTracking) + if (!currentBranch.IsTracking) { throw new LibGit2SharpException("There is no tracking information for the current branch."); } -- cgit v1.2.3 From d7e8a2e915f46c521dbff1b788bed2cb4fbd91bf Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:01:07 +0200 Subject: Drop optional parameters in CommitRewriteInfo.cs --- LibGit2Sharp/CommitRewriteInfo.cs | 46 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/LibGit2Sharp/CommitRewriteInfo.cs b/LibGit2Sharp/CommitRewriteInfo.cs index 5e0a5caa..a4387e83 100644 --- a/LibGit2Sharp/CommitRewriteInfo.cs +++ b/LibGit2Sharp/CommitRewriteInfo.cs @@ -35,6 +35,46 @@ namespace LibGit2Sharp }; } + /// + /// Build a from the passed in, + /// optionally overriding some of its properties + /// + /// The whose information is to be copied + /// Optional override for the author + /// A new object that matches the info for the + /// with the optional parameters replaced.. + public static CommitRewriteInfo From(Commit commit, Signature author) + { + return From(commit, author, null, null); + } + + /// + /// Build a from the passed in, + /// optionally overriding some of its properties + /// + /// The whose information is to be copied + /// Optional override for the message + /// A new object that matches the info for the + /// with the optional parameters replaced.. + public static CommitRewriteInfo From(Commit commit, string message) + { + return From(commit, null, null, message); + } + + /// + /// Build a from the passed in, + /// optionally overriding some of its properties + /// + /// The whose information is to be copied + /// Optional override for the author + /// Optional override for the committer + /// A new object that matches the info for the + /// with the optional parameters replaced.. + public static CommitRewriteInfo From(Commit commit, Signature author, Signature committer) + { + return From(commit, author, committer, null); + } + /// /// Build a from the passed in, /// optionally overriding some of its properties @@ -46,9 +86,9 @@ namespace LibGit2Sharp /// A new object that matches the info for the /// with the optional parameters replaced.. 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; -- cgit v1.2.3 From b3386c995f88d88b43b21788c20890de55bf795e Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:02:12 +0200 Subject: Drop optional parameters in BranchCollectionExtensions.cs --- LibGit2Sharp/BranchCollectionExtensions.cs | 39 +++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/LibGit2Sharp/BranchCollectionExtensions.cs b/LibGit2Sharp/BranchCollectionExtensions.cs index cea02c7a..68b15dec 100644 --- a/LibGit2Sharp/BranchCollectionExtensions.cs +++ b/LibGit2Sharp/BranchCollectionExtensions.cs @@ -7,6 +7,18 @@ namespace LibGit2Sharp /// public static class BranchCollectionExtensions { + /// + /// Create a new local branch with the specified name + /// + /// The being worked with. + /// The name of the branch. + /// The target commit. + /// A new . + public static Branch Add(this BranchCollection branches, string name, Commit commit) + { + return branches.Add(name, commit, false); + } + /// /// Create a new local branch with the specified name /// @@ -15,13 +27,22 @@ namespace LibGit2Sharp /// The target commit. /// True to allow silent overwriting a potentially existing branch, false otherwise. /// A new . - public static Branch Add(this BranchCollection branches, string name, Commit commit, bool allowOverwrite = false) + public static Branch Add(this BranchCollection branches, string name, Commit commit, bool allowOverwrite) { Ensure.ArgumentNotNull(commit, "commit"); return branches.Add(name, commit.Sha, allowOverwrite); } + /// + /// Deletes the branch with the specified name. + /// + /// The name of the branch to delete. + /// The being worked with. + public static void Remove(this BranchCollection branches, string name) + { + branches.Remove(name, false); + } /// /// Deletes the branch with the specified name. @@ -29,7 +50,7 @@ namespace LibGit2Sharp /// The name of the branch to delete. /// True if the provided is the name of a remote branch, false otherwise. /// The being worked with. - public static void Remove(this BranchCollection branches, string name, bool isRemote = false) + public static void Remove(this BranchCollection branches, string name, bool isRemote) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -45,6 +66,18 @@ namespace LibGit2Sharp branches.Remove(branch); } + /// + /// Rename an existing local branch, using the default reflog message + /// + /// The current branch name. + /// The new name the existing branch should bear. + /// The being worked with. + /// A new . + public static Branch Rename(this BranchCollection branches, string currentName, string newName) + { + return branches.Rename(currentName, newName, false); + } + /// /// Rename an existing local branch, using the default reflog message /// @@ -53,7 +86,7 @@ namespace LibGit2Sharp /// True to allow silent overwriting a potentially existing branch, false otherwise. /// The being worked with. /// A new . - public static Branch Rename(this BranchCollection branches, string currentName, string newName, bool allowOverwrite = false) + public static Branch Rename(this BranchCollection branches, string currentName, string newName, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(currentName, "currentName"); Ensure.ArgumentNotNullOrEmptyString(newName, "newName"); -- cgit v1.2.3 From 40bbf1e496b512537aa8a7928a2e133f21e7351c Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:02:38 +0200 Subject: Drop optional parameters in BranchCollection.cs --- LibGit2Sharp/BranchCollection.cs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index b4e617b2..42834d04 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -106,6 +106,17 @@ namespace LibGit2Sharp #endregion + /// + /// Create a new local branch with the specified name + /// + /// The name of the branch. + /// Revparse spec for the target commit. + /// A new . + public virtual Branch Add(string name, string committish) + { + return Add(name, committish, false); + } + /// /// Create a new local branch with the specified name /// @@ -113,7 +124,7 @@ namespace LibGit2Sharp /// Revparse spec for the target commit. /// True to allow silent overwriting a potentially existing branch, false otherwise. /// A new . - public virtual Branch Add(string name, string committish, bool allowOverwrite = false) + public virtual Branch Add(string name, string committish, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(committish, "committish"); @@ -138,6 +149,17 @@ namespace LibGit2Sharp } } + /// + /// Rename an existing local branch + /// + /// The current local branch. + /// The new name the existing branch should bear. + /// A new . + public virtual Branch Rename(Branch branch, string newName) + { + return Rename(branch, newName, false); + } + /// /// Rename an existing local branch /// @@ -145,7 +167,7 @@ namespace LibGit2Sharp /// The new name the existing branch should bear. /// True to allow silent overwriting a potentially existing branch, false otherwise. /// A new . - public virtual Branch Rename(Branch branch, string newName, bool allowOverwrite = false) + public virtual Branch Rename(Branch branch, string newName, bool allowOverwrite) { Ensure.ArgumentNotNull(branch, "branch"); Ensure.ArgumentNotNullOrEmptyString(newName, "newName"); -- cgit v1.2.3 From 32da01c5ff73d73f2865528521e39a8e740596d7 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:02:57 +0200 Subject: Drop optional parameters in BlobExtensions.cs --- LibGit2Sharp/BlobExtensions.cs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/LibGit2Sharp/BlobExtensions.cs b/LibGit2Sharp/BlobExtensions.cs index 0b38c32f..7dade3ce 100644 --- a/LibGit2Sharp/BlobExtensions.cs +++ b/LibGit2Sharp/BlobExtensions.cs @@ -9,21 +9,44 @@ namespace LibGit2Sharp /// public static class BlobExtensions { + /// + /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected from the byte order mark + /// + /// The blob for which the content will be returned. + /// Blob content as text. + public static string GetContentText(this Blob blob) + { + Ensure.ArgumentNotNull(blob, "blob"); + + return ReadToEnd(blob.GetContentStream(), null); + } + /// /// Gets the blob content decoded with the specified encoding, - /// or according to byte order marks, with UTF8 as fallback, - /// if is null. + /// or according to byte order marks, or the specified encoding as a fallback /// /// The blob for which the content will be returned. - /// The encoding of the text. (default: detected or UTF8) + /// The encoding of the text to use, if it cannot be detected /// Blob content as text. - public static string GetContentText(this Blob blob, Encoding encoding = null) + public static string GetContentText(this Blob blob, Encoding encoding) { Ensure.ArgumentNotNull(blob, "blob"); + Ensure.ArgumentNotNull(encoding, "encoding"); return ReadToEnd(blob.GetContentStream(), encoding); } + /// + /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected + /// + /// The blob for which the content will be returned. + /// Parameter controlling content filtering behavior + /// Blob content as text. + public static string GetContentText(this Blob blob, FilteringOptions filteringOptions) + { + return blob.GetContentText(filteringOptions, null); + } + /// /// Gets the blob content as it would be checked out to the /// working directory, decoded with the specified encoding, @@ -34,7 +57,7 @@ namespace LibGit2Sharp /// Parameter controlling content filtering behavior /// The encoding of the text. (default: detected or UTF8) /// Blob content as text. - 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"); -- cgit v1.2.3 From 44aa1498f8159b169af93895c60a7a68c6c1ca2b Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:04:10 +0200 Subject: Drop optional parameters in Diff.cs --- LibGit2Sharp/Diff.cs | 218 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 7 deletions(-) diff --git a/LibGit2Sharp/Diff.cs b/LibGit2Sharp/Diff.cs index 126d4bec..54ad11b0 100644 --- a/LibGit2Sharp/Diff.cs +++ b/LibGit2Sharp/Diff.cs @@ -102,6 +102,17 @@ namespace LibGit2Sharp { typeof(PatchStats), diff => new PatchStats(diff) }, }; + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// A containing the changes between the and the . + public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob) + { + return Compare(oldBlob, newBlob, null); + } + /// /// Show changes between two s. /// @@ -109,7 +120,7 @@ namespace LibGit2Sharp /// The you want to compare to. /// Additional options to define comparison behavior. /// A containing the changes between the and the . - public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions compareOptions = null) + public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions compareOptions) { using (GitDiffOptions options = BuildOptions(DiffModifiers.None, compareOptions: compareOptions)) { @@ -117,6 +128,71 @@ namespace LibGit2Sharp } } + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// A containing the changes between the and the . + public virtual T Compare(Tree oldTree, Tree newTree) where T : class + { + return Compare(oldTree, newTree, null, null, null); + } + + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// The list of paths (either files or directories) that should be compared. + /// A containing the changes between the and the . + public virtual T Compare(Tree oldTree, Tree newTree, IEnumerable paths) where T : class + { + return Compare(oldTree, newTree, paths, null, null); + } + + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// The list of paths (either files or directories) that should be compared. + /// + /// If set, the passed will be treated as explicit paths. + /// Use these options to determine how unmatched explicit paths should be handled. + /// + /// A containing the changes between the and the . + public virtual T Compare(Tree oldTree, Tree newTree, IEnumerable paths, + ExplicitPathsOptions explicitPathsOptions) where T : class + { + return Compare(oldTree, newTree, paths, explicitPathsOptions, null); + } + + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// The list of paths (either files or directories) that should be compared. + /// Additional options to define patch generation behavior. + /// A containing the changes between the and the . + public virtual T Compare(Tree oldTree, Tree newTree, IEnumerable paths, CompareOptions compareOptions) where T : class + { + return Compare(oldTree, newTree, paths, null, compareOptions); + } + + /// + /// Show changes between two s. + /// + /// The you want to compare from. + /// The you want to compare to. + /// Additional options to define patch generation behavior. + /// A containing the changes between the and the . + public virtual T Compare(Tree oldTree, Tree newTree, CompareOptions compareOptions) where T : class + { + return Compare(oldTree, newTree, null, null, compareOptions); + } + /// /// Show changes between two s. /// @@ -129,8 +205,8 @@ namespace LibGit2Sharp /// /// Additional options to define patch generation behavior. /// A containing the changes between the and the . - public virtual T Compare(Tree oldTree, Tree newTree, IEnumerable paths = null, ExplicitPathsOptions explicitPathsOptions = null, - CompareOptions compareOptions = null) where T : class + public virtual T Compare(Tree oldTree, Tree newTree, IEnumerable paths, ExplicitPathsOptions explicitPathsOptions, + CompareOptions compareOptions) where T : class { Func builder; @@ -164,6 +240,64 @@ namespace LibGit2Sharp } } + /// + /// Show changes between a and the Index, the Working Directory, or both. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The to compare from. + /// The targets to compare to. + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the and the selected target. + public virtual T Compare(Tree oldTree, DiffTargets diffTargets) where T : class + { + return Compare(oldTree, diffTargets, null, null, null); + } + + /// + /// Show changes between a and the Index, the Working Directory, or both. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The to compare from. + /// The targets to compare to. + /// The list of paths (either files or directories) that should be compared. + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the and the selected target. + public virtual T Compare(Tree oldTree, DiffTargets diffTargets, IEnumerable paths) where T : class + { + return Compare(oldTree, diffTargets, paths, null, null); + } + + /// + /// Show changes between a and the Index, the Working Directory, or both. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The to compare from. + /// The targets to compare to. + /// The list of paths (either files or directories) that should be compared. + /// + /// If set, the passed will be treated as explicit paths. + /// Use these options to determine how unmatched explicit paths should be handled. + /// + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the and the selected target. + public virtual T Compare(Tree oldTree, DiffTargets diffTargets, IEnumerable paths, + ExplicitPathsOptions explicitPathsOptions) where T : class + { + return Compare(oldTree, diffTargets, paths, explicitPathsOptions, null); + } + /// /// Show changes between a and the Index, the Working Directory, or both. /// @@ -182,8 +316,8 @@ namespace LibGit2Sharp /// Can be either a if you are only interested in the list of files modified, added, ..., or /// a if you want the actual patch content for the whole diff and for individual files. /// A containing the changes between the and the selected target. - public virtual T Compare(Tree oldTree, DiffTargets diffTargets, IEnumerable paths = null, - ExplicitPathsOptions explicitPathsOptions = null, CompareOptions compareOptions = null) where T : class + public virtual T Compare(Tree oldTree, DiffTargets diffTargets, IEnumerable paths, + ExplicitPathsOptions explicitPathsOptions, CompareOptions compareOptions) where T : class { Func builder; @@ -219,6 +353,76 @@ namespace LibGit2Sharp } } + /// + /// Show changes between the working directory and the index. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the working directory and the index. + public virtual T Compare() where T : class + { + return Compare(DiffModifiers.None); + } + + /// + /// Show changes between the working directory and the index. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The list of paths (either files or directories) that should be compared. + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the working directory and the index. + public virtual T Compare(IEnumerable paths) where T : class + { + return Compare(DiffModifiers.None, paths); + } + + /// + /// Show changes between the working directory and the index. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The list of paths (either files or directories) that should be compared. + /// If true, include untracked files from the working dir as additions. Otherwise ignore them. + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the working directory and the index. + public virtual T Compare(IEnumerable paths, bool includeUntracked) where T : class + { + return Compare(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths); + } + + /// + /// Show changes between the working directory and the index. + /// + /// The level of diff performed can be specified by passing either a + /// or type as the generic parameter. + /// + /// + /// The list of paths (either files or directories) that should be compared. + /// If true, include untracked files from the working dir as additions. Otherwise ignore them. + /// + /// If set, the passed will be treated as explicit paths. + /// Use these options to determine how unmatched explicit paths should be handled. + /// + /// Can be either a if you are only interested in the list of files modified, added, ..., or + /// a if you want the actual patch content for the whole diff and for individual files. + /// A containing the changes between the working directory and the index. + public virtual T Compare(IEnumerable paths, bool includeUntracked, + ExplicitPathsOptions explicitPathsOptions) where T : class + { + return Compare(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths, explicitPathsOptions); + } + /// /// Show changes between the working directory and the index. /// @@ -236,8 +440,8 @@ namespace LibGit2Sharp /// Can be either a if you are only interested in the list of files modified, added, ..., or /// a if you want the actual patch content for the whole diff and for individual files. /// A containing the changes between the working directory and the index. - public virtual T Compare(IEnumerable paths = null, bool includeUntracked = false, ExplicitPathsOptions explicitPathsOptions = null, - CompareOptions compareOptions = null) where T : class + public virtual T Compare(IEnumerable paths, bool includeUntracked, ExplicitPathsOptions explicitPathsOptions, + CompareOptions compareOptions) where T : class { return Compare(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths, explicitPathsOptions, compareOptions); } -- cgit v1.2.3 From 5109f5979d92f92c74144a4595e35d8094dc9a53 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:04:55 +0200 Subject: Ensure lack of optional parameters --- LibGit2Sharp.Tests/MetaFixture.cs | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/LibGit2Sharp.Tests/MetaFixture.cs b/LibGit2Sharp.Tests/MetaFixture.cs index df0a1d96..685ff5f4 100644 --- a/LibGit2Sharp.Tests/MetaFixture.cs +++ b/LibGit2Sharp.Tests/MetaFixture.cs @@ -299,5 +299,59 @@ namespace LibGit2Sharp.Tests Assert.True(false, Environment.NewLine + sb.ToString()); } } + + [Fact] + public void NoOptionalParametersinMethods() + { + IEnumerable mis = + from t in Assembly.GetAssembly(typeof(IRepository)) + .GetExportedTypes() + from m in t.GetMethods() + where !m.IsObsolete() + from p in m.GetParameters() + where p.IsOptional + select m.DeclaringType + "." + m.Name; + + var sb = new StringBuilder(); + + foreach (var method in mis.Distinct()) + { + sb.AppendFormat("At least one overload of method '{0}' accepts an optional parameter.{1}", + method, Environment.NewLine); + } + + Assert.Equal("", sb.ToString()); + } + + [Fact] + public void NoOptionalParametersinConstructors() + { + IEnumerable mis = + from t in Assembly.GetAssembly(typeof(IRepository)) + .GetExportedTypes() + from c in t.GetConstructors() + from p in c.GetParameters() + where p.IsOptional + select c.DeclaringType.Name; + + var sb = new StringBuilder(); + + foreach (var method in mis.Distinct()) + { + sb.AppendFormat("At least one constructor of type '{0}' accepts an optional parameter.{1}", + method, Environment.NewLine); + } + + Assert.Equal("", sb.ToString()); + } + } + + internal static class TypeExtensions + { + internal static bool IsObsolete(this MethodInfo methodInfo) + { + var attributes = methodInfo.GetCustomAttributes(false); + return attributes.Any(a => a is ObsoleteAttribute); + } } } -- cgit v1.2.3 From 62cc73e89fe06b1e17531a63cfef633ece9fbcbe Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:07:16 +0200 Subject: Fix Resharper private member prefix setting --- LibGit2Sharp.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LibGit2Sharp.sln.DotSettings b/LibGit2Sharp.sln.DotSettings index ce4b3194..8bc2282a 100644 --- a/LibGit2Sharp.sln.DotSettings +++ b/LibGit2Sharp.sln.DotSettings @@ -10,6 +10,8 @@ False True True + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + True True True -- cgit v1.2.3