From 34779a2a36132d5e4bc269a2ded02adc3d06216a Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Wed, 21 Oct 2015 05:08:10 -0500 Subject: [PATCH] Make PackBuilder methods chainable --- LibGit2Sharp/PackBuilder.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/LibGit2Sharp/PackBuilder.cs b/LibGit2Sharp/PackBuilder.cs index 02ea76dc7..a656baed2 100644 --- a/LibGit2Sharp/PackBuilder.cs +++ b/LibGit2Sharp/PackBuilder.cs @@ -30,11 +30,13 @@ internal PackBuilder(Repository repository) /// /// The object to be inserted. /// if the gitObject is null - public void Add(T gitObject) where T : GitObject + public PackBuilder Add(T gitObject) where T : GitObject { Ensure.ArgumentNotNull(gitObject, "gitObject"); Add(gitObject.Id); + + return this; } /// @@ -43,11 +45,13 @@ public void Add(T gitObject) where T : GitObject /// /// The object to be inserted recursively. /// if the gitObject is null - public void AddRecursively(T gitObject) where T : GitObject + public PackBuilder AddRecursively(T gitObject) where T : GitObject { Ensure.ArgumentNotNull(gitObject, "gitObject"); AddRecursively(gitObject.Id); + + return this; } /// @@ -56,11 +60,13 @@ public void AddRecursively(T gitObject) where T : GitObject /// /// The object ID to be inserted. /// if the id is null - public void Add(ObjectId id) + public PackBuilder Add(ObjectId id) { Ensure.ArgumentNotNull(id, "id"); Proxy.git_packbuilder_insert(packBuilderHandle, id, null); + + return this; } /// @@ -69,11 +75,13 @@ public void Add(ObjectId id) /// /// The object ID to be recursively inserted. /// if the id is null - public void AddRecursively(ObjectId id) + public PackBuilder AddRecursively(ObjectId id) { Ensure.ArgumentNotNull(id, "id"); Proxy.git_packbuilder_insert_recur(packBuilderHandle, id, null); + + return this; } ///