using System.IO;
namespace LibGit2Sharp
{
///
/// Provides helper overloads to a .
///
public static class ObjectDatabaseExtensions
{
///
/// Create a TAR archive of the given tree.
///
/// The object database.
/// The tree.
/// The archive path.
public static void Archive(this ObjectDatabase odb, Tree tree, string archivePath)
{
using (var output = new FileStream(archivePath, FileMode.Create))
using (var archiver = new TarArchiver(output))
{
odb.Archive(tree, archiver);
}
}
///
/// Create a TAR archive of the given commit.
///
/// The object database.
/// commit.
/// The archive path.
public static void Archive(this ObjectDatabase odb, Commit commit, string archivePath)
{
using (var output = new FileStream(archivePath, FileMode.Create))
using (var archiver = new TarArchiver(output))
{
odb.Archive(commit, archiver);
}
}
}
}