e8f4902998e3f89c02b6331db31978070d4eff5f — Scherb Vincent 1 year, 10 months ago 1463e21
Add simple check for the library

Checking if a Repository is valid will use the library to check if that
path contains a valid git repository.

Signed-off-by: Scherb Vincent <scherb.vincent@gmail.com>
1 files changed, 11 insertions(+), 2 deletions(-)

M poc_libgit2sharp/Program.cs
M poc_libgit2sharp/Program.cs => poc_libgit2sharp/Program.cs +11 -2
@@ 1,2 1,11 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
using LibGit2Sharp;

string currentDirectory = Directory.GetCurrentDirectory();
Console.WriteLine("Current directory is '{0}'", currentDirectory);
Console.WriteLine("Checking whether the directory contains a valid git repository.");
Console.WriteLine("Should return true as the program is run from a repository.");
bool directoryIsARepository = Repository.IsValid(currentDirectory);
Console.WriteLine("This message indicates that no exception was thrown and the library works as expected.");
Console.WriteLine("The directory '{0}' is a git repository '{1}'", currentDirectory, directoryIsARepository);

return directoryIsARepository ? 0 : 1;