Skip to content

Fluent PackBuilder #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions LibGit2Sharp/PackBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ internal PackBuilder(Repository repository)
/// </summary>
/// <param name="gitObject">The object to be inserted.</param>
/// <exception cref="ArgumentNullException">if the gitObject is null</exception>
public void Add<T>(T gitObject) where T : GitObject
public PackBuilder Add<T>(T gitObject) where T : GitObject
{
Ensure.ArgumentNotNull(gitObject, "gitObject");

Add(gitObject.Id);

return this;
}

/// <summary>
Expand All @@ -43,11 +45,13 @@ public void Add<T>(T gitObject) where T : GitObject
/// </summary>
/// <param name="gitObject">The object to be inserted recursively.</param>
/// <exception cref="ArgumentNullException">if the gitObject is null</exception>
public void AddRecursively<T>(T gitObject) where T : GitObject
public PackBuilder AddRecursively<T>(T gitObject) where T : GitObject
{
Ensure.ArgumentNotNull(gitObject, "gitObject");

AddRecursively(gitObject.Id);

return this;
}

/// <summary>
Expand All @@ -56,11 +60,13 @@ public void AddRecursively<T>(T gitObject) where T : GitObject
/// </summary>
/// <param name="id">The object ID to be inserted.</param>
/// <exception cref="ArgumentNullException">if the id is null</exception>
public void Add(ObjectId id)
public PackBuilder Add(ObjectId id)
{
Ensure.ArgumentNotNull(id, "id");

Proxy.git_packbuilder_insert(packBuilderHandle, id, null);

return this;
}

/// <summary>
Expand All @@ -69,11 +75,13 @@ public void Add(ObjectId id)
/// </summary>
/// <param name="id">The object ID to be recursively inserted.</param>
/// <exception cref="ArgumentNullException">if the id is null</exception>
public void AddRecursively(ObjectId id)
public PackBuilder AddRecursively(ObjectId id)
{
Ensure.ArgumentNotNull(id, "id");

Proxy.git_packbuilder_insert_recur(packBuilderHandle, id, null);

return this;
}

/// <summary>
Expand Down