Пример #1
0
 public string GetSignature()
 {
     if (string.IsNullOrEmpty(signature_) == false)
     {
         return(signature_);
     }
     signature_ = GitWrapper.GetSignature();
     return(signature_);
 }
Пример #2
0
        // return true if selected yes and initialized git
        public static bool AskAndGitInit(string directory)
        {
            string message = $"Invalid git root directory:{directory}\n\n";

            message += $"Initialize as GIT repository?\n\n";
            message += $"This will execute 'git init' and create {directory}\\.git directory";
            if (ShowMessageWithYesNo(message) != MessageBoxResult.Yes)
            {
                return(false);
            }
            GitWrapper gitWrapper = new GitWrapper(directory, null);

            gitWrapper.Init();

            return(true);
        }
Пример #3
0
        public static bool IsValidGitDirectory(string directory)
        {
            if (string.IsNullOrEmpty(directory))
            {
                return(false);
            }
            if (Directory.Exists(directory) == false)
            {
                return(false);
            }
            if (Directory.Exists(Path.Combine(directory, ".git")) == false)
            {
                return(false);
            }
            GitWrapper git_wrapper = new GitWrapper(directory, null);

            if (git_wrapper.IsValidGitDirectory() == false)
            {
                return(false);
            }
            return(true);
        }
Пример #4
0
        public void OnChangeDirectory(object parameter)
        {
            if (String.IsNullOrEmpty(Directory))
            {
                string msg = "Directory is empty";
                Service.GetInstance().ShowMsg(msg);
                return;
            }
            if (System.IO.Directory.Exists(Directory) == false)
            {
                string msg = "Directory does not exist";
                Service.GetInstance().ShowMsg(msg);
                return;
            }
            if (LibGit2Sharp.Repository.IsValid(Directory) == false)
            {
                string msg = "Directory is not a valid git directory";
                Service.GetInstance().ShowMsg(msg);
                return;
            }
            git_ = new GitWrapper(Directory);

            Service.GetInstance().SetRootPath(Directory);

            Refresh();
            DirectoryUsed(Directory);
        }