예제 #1
0
        public static IEnumerable <string> Checkout(string treeish, IEnumerable <string> paths = null, GitArguments.CheckoutOptions options = default)
        {
            if (string.IsNullOrEmpty(treeish))
            {
                throw new ArgumentNullException(nameof(treeish));
            }

            yield return("checkout");

            yield return("-q");

            if (options.Track)
            {
                yield return("--track");
            }

            yield return(treeish);

            if (paths != null)
            {
                yield return("--");

                foreach (var path in paths.Select(QuoteEscape))
                {
                    yield return(path);
                }
            }
        }
예제 #2
0
 public Task <ExecutionResult> CheckoutAsync(string treeish, IEnumerable <string> paths = null, GitArguments.CheckoutOptions options = default)
 => RunGitAsync(GitArguments.Checkout(treeish, paths, options));