-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force-checkout remote branch to fix unrelated histories (#228)
* Force-checkout remote branch to resolve unrelated histories * Test fixes * Use Println() * * * * * * * go-utils update
- Loading branch information
Showing
9 changed files
with
32 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,8 +76,7 @@ func Test_checkoutState(t *testing.T) { | |
}, | ||
wantCmds: []string{ | ||
`git "fetch" "--jobs=10" "--depth=1" "--no-tags" "--no-recurse-submodules" "origin" "refs/heads/hcnarb"`, | ||
`git "checkout" "hcnarb"`, | ||
`git "merge" "origin/hcnarb"`, | ||
`git "checkout" "-B" "hcnarb" "origin/hcnarb"`, | ||
}, | ||
}, | ||
{ | ||
|
@@ -204,7 +203,7 @@ func Test_checkoutState(t *testing.T) { | |
`git "fetch" "--jobs=10"`, | ||
`git "branch" "-r"`, | ||
}, | ||
wantErr: fmt.Errorf("failed to fetch base branch: failed to fetch branch (refs/heads/master): dummy_cmd_error: please make sure the branch still exists"), | ||
wantErr: fmt.Errorf("failed to fetch base branch: fetch branch refs/heads/master: dummy_cmd_error: please make sure the branch still exists"), | ||
}, | ||
{ | ||
name: "PR - fork - no merge ref - diff file available", | ||
|
@@ -245,8 +244,7 @@ func Test_checkoutState(t *testing.T) { | |
`git "checkout" "master"`, | ||
`git "apply" "--index" "diff_path"`, | ||
`git "fetch" "--jobs=10" "--depth=1" "--no-tags" "--no-recurse-submodules" "origin" "refs/heads/master"`, | ||
`git "checkout" "master"`, | ||
`git "merge" "origin/master"`, | ||
`git "checkout" "-B" "master" "origin/master"`, | ||
`git "log" "-1" "--format=%H"`, | ||
`git "fetch" "--jobs=10" "--depth=1" "--no-tags" "--no-recurse-submodules" "origin" "refs/heads/test/commit-messages"`, | ||
`git "merge" "76a934ae"`, | ||
|
@@ -273,8 +271,7 @@ func Test_checkoutState(t *testing.T) { | |
`git "checkout" "master"`, | ||
`git "apply" "--index" "diff_path"`, | ||
`git "fetch" "--jobs=10" "--depth=1" "--no-tags" "--no-recurse-submodules" "origin" "refs/heads/master"`, | ||
`git "checkout" "master"`, | ||
`git "merge" "origin/master"`, | ||
`git "checkout" "-B" "master" "origin/master"`, | ||
`git "log" "-1" "--format=%H"`, | ||
`git "remote" "add" "fork" "[email protected]:bitrise-io/other-repo.git"`, | ||
`git "fetch" "--jobs=10" "--depth=1" "--no-tags" "--no-recurse-submodules" "fork" "refs/heads/test/commit-messages"`, | ||
|
@@ -375,7 +372,7 @@ func Test_checkoutState(t *testing.T) { | |
}, | ||
wantErr: newStepErrorWithBranchRecommendations( | ||
fetchFailedTag, | ||
fmt.Errorf("failed to fetch branch (refs/heads/fake): %w: please make sure the branch still exists", errors.New(rawCmdError)), | ||
fmt.Errorf("fetch branch refs/heads/fake: %w: please make sure the branch still exists", errors.New(rawCmdError)), | ||
"Fetching repository has failed", | ||
"fake", | ||
[]string{"master"}, | ||
|
@@ -466,8 +463,7 @@ func Test_checkoutState(t *testing.T) { | |
}, | ||
wantCmds: []string{ | ||
`git "fetch" "--jobs=10" "--depth=1" "--filter=tree:0" "--no-tags" "--no-recurse-submodules" "origin" "refs/heads/hcnarb"`, | ||
`git "checkout" "hcnarb"`, | ||
`git "merge" "origin/hcnarb"`, | ||
`git "checkout" "-B" "hcnarb" "origin/hcnarb"`, | ||
}, | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
vendor/github.com/bitrise-io/go-utils/command/git/commands.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters