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