Exemplo n.º 1
0
        public static GitTask Run(string args)
        {
            var task = new GitTask(args);

            task.Execute(r => {});
            return(task);
        }
        public void Execute(Action <Result <string> > onComplete)
        {
            var workingDirectory = Settings.AbsolutePackagesDirectoryPath + package.Name;

            var symbolic = new GitTask("symbolic-ref -q --short HEAD");

            symbolic.WorkingDirectory = workingDirectory;
            symbolic.Execute(symbolicResult =>
            {
                if (symbolicResult.IsError || symbolicResult.StdOut.Count == 0)
                {
                    var tags = new GitTask("describe --tags --exact-match");
                    tags.WorkingDirectory = workingDirectory;
                    tags.Execute(tagsResult =>
                    {
                        onComplete(new Result <string>(tagsResult.StdOut[0]));
                    });
                    return;
                }

                onComplete(new Result <string>(symbolicResult.StdOut[0]));
            });
        }