MCPcopy Create free account
hub / github.com/libgit2/git2go / TestRebaseAbort

Function TestRebaseAbort

rebase_test.go:91–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestRebaseAbort(t *testing.T) {
92 // TEST DATA
93
94 // Inputs
95 branchName := "emile"
96 masterCommit := "something"
97 emileCommits := []string{
98 "fou",
99 "barre",
100 }
101
102 // Outputs
103 expectedHistory := []string{
104 "Test rebase, Baby! " + emileCommits[1],
105 "Test rebase, Baby! " + emileCommits[0],
106 "This is a commit\n",
107 }
108
109 // TEST
110 repo := createTestRepo(t)
111 defer cleanupTestRepo(t, repo)
112 seedTestRepo(t, repo)
113
114 // Setup a repo with 2 branches and a different tree
115 err := setupRepoForRebase(repo, masterCommit, branchName, commitOptions{})
116 checkFatal(t, err)
117
118 // Create several commits in emile
119 for _, commit := range emileCommits {
120 _, err = commitSomething(repo, commit, commit, commitOptions{})
121 checkFatal(t, err)
122 }
123
124 // Check history
125 actualHistory, err := commitMsgsList(repo)
126 checkFatal(t, err)
127 assertStringList(t, expectedHistory, actualHistory)
128
129 // Rebase onto master
130 rebase, err := performRebaseOnto(repo, "master", nil)
131 checkFatal(t, err)
132 defer rebase.Free()
133
134 // Abort rebase
135 rebase.Abort()
136
137 // Check history is still the same
138 actualHistory, err = commitMsgsList(repo)
139 checkFatal(t, err)
140 assertStringList(t, expectedHistory, actualHistory)
141}
142
143func TestRebaseNoConflicts(t *testing.T) {
144 // TEST DATA

Callers

nothing calls this directly

Calls 11

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
setupRepoForRebaseFunction · 0.85
checkFatalFunction · 0.85
commitSomethingFunction · 0.85
commitMsgsListFunction · 0.85
assertStringListFunction · 0.85
performRebaseOntoFunction · 0.85
AbortMethod · 0.80
FreeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…