Skip to content

Commit

Permalink
Revert "Clone repositories with a depth of 1 (#104)" (#116)
Browse files Browse the repository at this point in the history
This reverts commit c45db62.

Co-authored-by: Danny Ranson <[email protected]>
  • Loading branch information
Dan7-7-7 and Danny Ranson authored Nov 13, 2023
1 parent 119f8ff commit dfa566c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions internal/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions internal/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
})
}

Expand All @@ -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"},
})
}

Expand All @@ -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"},
})
}

Expand All @@ -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"},
})
}

Expand Down

0 comments on commit dfa566c

Please sign in to comment.