From dfa566c4d729b0447a88cad9ebe8b3f3979764c5 Mon Sep 17 00:00:00 2001 From: Daniel Ranson <92924979+Dan7-7-7@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:30:26 +0000 Subject: [PATCH] Revert "Clone repositories with a depth of 1 (#104)" (#116) This reverts commit c45db62331643d365c3a8dc9bc81705cf82007fd. Co-authored-by: Danny Ranson --- README.md | 13 +------------ internal/github/github.go | 4 ++-- internal/github/github_test.go | 8 ++++---- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 32487b7..fabf73c 100644 --- a/README.md +++ b/README.md @@ -123,18 +123,7 @@ turbolift foreach --repos repoFile2.txt sed 's/pattern2/replacement2/g' This creates a fork and clones all repositories listed in the `repos.txt` file into the `work` directory. You may wish to skip the fork and work on the upstream repository branch directly with the flag `--no-fork`. -> NTLD: if one of the repositories in the list requires a fork to create a PR, -> omit the `--no-fork` flag and let all the repositories be forked. -> For now, it's an all-or-nothing scenario. - -> [!NOTE] -> Repositories are cloned with the git flag `--depth=1`. -> If you need the full commit history and tags, you can run the following command -> after running `turbolift clone`: -> -> ```shell -> turbolift foreach git fetch --unshallow --tags -> ``` +> NTLD: if one of the repositories in the list requires a fork to create a PR, omit the `--no-fork` flag and let all the repositories be forked. For now it's a all-or-nothing scenario. ### Making changes diff --git a/internal/github/github.go b/internal/github/github.go index a0165b6..2b32cd8 100644 --- a/internal/github/github.go +++ b/internal/github/github.go @@ -72,11 +72,11 @@ func (r *RealGitHub) CreatePullRequest(output io.Writer, workingDir string, pr P } func (r *RealGitHub) ForkAndClone(output io.Writer, workingDir string, fullRepoName string) error { - return execInstance.Execute(output, workingDir, "gh", "repo", "fork", "--clone=true", fullRepoName, "--", "--depth=1") + return execInstance.Execute(output, workingDir, "gh", "repo", "fork", "--clone=true", fullRepoName) } func (r *RealGitHub) Clone(output io.Writer, workingDir string, fullRepoName string) error { - return execInstance.Execute(output, workingDir, "gh", "repo", "clone", fullRepoName, "--", "--depth=1") + return execInstance.Execute(output, workingDir, "gh", "repo", "clone", fullRepoName) } func (r *RealGitHub) ClosePullRequest(output io.Writer, workingDir string, branchName string) error { diff --git a/internal/github/github_test.go b/internal/github/github_test.go index 8746dba..58e3f89 100644 --- a/internal/github/github_test.go +++ b/internal/github/github_test.go @@ -31,7 +31,7 @@ func TestItReturnsErrorOnFailedFork(t *testing.T) { assert.Error(t, err) fakeExecutor.AssertCalledWith(t, [][]string{ - {"work/org", "gh", "repo", "fork", "--clone=true", "org/repo1", "--", "--depth=1"}, + {"work/org", "gh", "repo", "fork", "--clone=true", "org/repo1"}, }) } @@ -43,7 +43,7 @@ func TestItReturnsNilErrorOnSuccessfulFork(t *testing.T) { assert.NoError(t, err) fakeExecutor.AssertCalledWith(t, [][]string{ - {"work/org", "gh", "repo", "fork", "--clone=true", "org/repo1", "--", "--depth=1"}, + {"work/org", "gh", "repo", "fork", "--clone=true", "org/repo1"}, }) } @@ -55,7 +55,7 @@ func TestItReturnsErrorOnFailedClone(t *testing.T) { assert.Error(t, err) fakeExecutor.AssertCalledWith(t, [][]string{ - {"work/org", "gh", "repo", "clone", "org/repo1", "--", "--depth=1"}, + {"work/org", "gh", "repo", "clone", "org/repo1"}, }) } @@ -67,7 +67,7 @@ func TestItReturnsNilErrorOnSuccessfulClone(t *testing.T) { assert.NoError(t, err) fakeExecutor.AssertCalledWith(t, [][]string{ - {"work/org", "gh", "repo", "clone", "org/repo1", "--", "--depth=1"}, + {"work/org", "gh", "repo", "clone", "org/repo1"}, }) }