mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
24 lines
670 B
C#
24 lines
670 B
C#
using System.IO;
|
|
|
|
namespace SourceGit.Commands
|
|
{
|
|
public class IsBareRepository : Command
|
|
{
|
|
public IsBareRepository(string path)
|
|
{
|
|
WorkingDirectory = path;
|
|
Args = "rev-parse --is-bare-repository";
|
|
}
|
|
|
|
public bool Result()
|
|
{
|
|
if (!Directory.Exists(Path.Combine(WorkingDirectory, "refs")) ||
|
|
!Directory.Exists(Path.Combine(WorkingDirectory, "objects")) ||
|
|
!File.Exists(Path.Combine(WorkingDirectory, "HEAD")))
|
|
return false;
|
|
|
|
var rs = ReadToEnd();
|
|
return rs.IsSuccess && rs.StdOut.Trim() == "true";
|
|
}
|
|
}
|
|
}
|