diff options
author | Brendan Forster <brendan@github.com> | 2015-05-10 12:54:45 +0300 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2015-05-15 20:31:41 +0300 |
commit | bce3f4c1320ebd5b72a40d8bc4ce7954ab8d37ee (patch) | |
tree | 9fea83d51d81f83ccde07fb44d088f2a1be865f0 | |
parent | d16fbec108572d20f142127aba6c31f17074f932 (diff) |
Drop optional parameters in ReferenceCollectionExtensions.cs
-rw-r--r-- | LibGit2Sharp/ReferenceCollectionExtensions.cs | 73 |
1 files 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 @@ -39,9 +39,23 @@ namespace LibGit2Sharp /// <param name="name">The name of the reference to create.</param> /// <param name="canonicalRefNameOrObjectish">The target which can be either the canonical name of a reference or a revparse spec.</param> /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="Reference"/></param> + /// <returns>A new <see cref="Reference"/>.</returns> + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish, + string logMessage) + { + return refsColl.Add(name, canonicalRefNameOrObjectish, logMessage, false); + } + + /// <summary> + /// Creates a direct or symbolic reference with the specified name and target + /// </summary> + /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> + /// <param name="name">The name of the reference to create.</param> + /// <param name="canonicalRefNameOrObjectish">The target which can be either the canonical name of a reference or a revparse spec.</param> + /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="Reference"/></param> /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param> /// <returns>A new <see cref="Reference"/>.</returns> - 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); } + + /// <summary> + /// Creates a direct or symbolic reference with the specified name and target + /// </summary> + /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> + /// <param name="name">The name of the reference to create.</param> + /// <param name="canonicalRefNameOrObjectish">The target which can be either the canonical name of a reference or a revparse spec.</param> + /// <returns>A new <see cref="Reference"/>.</returns> + public static Reference Add(this ReferenceCollection refsColl, string name, string canonicalRefNameOrObjectish) + { + return Add(refsColl, name, canonicalRefNameOrObjectish, null, false); + } + /// <summary> /// Creates a direct or symbolic reference with the specified name and target /// </summary> @@ -85,7 +112,7 @@ namespace LibGit2Sharp /// <param name="canonicalRefNameOrObjectish">The target which can be either the canonical name of a reference or a revparse spec.</param> /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param> /// <returns>A new <see cref="Reference"/>.</returns> - 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); } @@ -127,12 +154,52 @@ namespace LibGit2Sharp /// </summary> /// <param name="currentName">The canonical name of the reference to rename.</param> /// <param name="newName">The new canonical name.</param> + /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> + /// <returns>A new <see cref="Reference"/>.</returns> + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName) + { + return refsColl.Rename(currentName, newName, null, false); + } + + /// <summary> + /// Rename an existing reference with a new name + /// </summary> + /// <param name="currentName">The canonical name of the reference to rename.</param> + /// <param name="newName">The new canonical name.</param> + /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param> + /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> + /// <returns>A new <see cref="Reference"/>.</returns> + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName, + bool allowOverwrite) + { + return refsColl.Rename(currentName, newName, null, allowOverwrite); + } + + /// <summary> + /// Rename an existing reference with a new name + /// </summary> + /// <param name="currentName">The canonical name of the reference to rename.</param> + /// <param name="newName">The new canonical name.</param> + /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/></param> + /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> + /// <returns>A new <see cref="Reference"/>.</returns> + public static Reference Rename(this ReferenceCollection refsColl, string currentName, string newName, + string logMessage) + { + return refsColl.Rename(currentName, newName, logMessage, false); + } + + /// <summary> + /// Rename an existing reference with a new name + /// </summary> + /// <param name="currentName">The canonical name of the reference to rename.</param> + /// <param name="newName">The new canonical name.</param> /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/></param> /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param> /// <param name="refsColl">The <see cref="ReferenceCollection"/> being worked with.</param> /// <returns>A new <see cref="Reference"/>.</returns> 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"); |