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

Function TestRebaseNoConflicts

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

Source from the content-addressed store, hash-verified

141}
142
143func TestRebaseNoConflicts(t *testing.T) {
144 // TEST DATA
145
146 // Inputs
147 branchName := "emile"
148 masterCommit := "something"
149 emileCommits := []string{
150 "fou",
151 "barre",
152 "ouich",
153 }
154
155 // Outputs
156 expectedHistory := []string{
157 "Test rebase, Baby! " + emileCommits[2],
158 "Test rebase, Baby! " + emileCommits[1],
159 "Test rebase, Baby! " + emileCommits[0],
160 "Test rebase, Baby! " + masterCommit,
161 "This is a commit\n",
162 }
163
164 // TEST
165 repo := createTestRepo(t)
166 defer cleanupTestRepo(t, repo)
167 seedTestRepo(t, repo)
168
169 // Try to open existing rebase
170 oRebase, err := repo.OpenRebase(nil)
171 if err == nil {
172 t.Fatal("Did not expect to find a rebase in progress")
173 }
174
175 // Setup a repo with 2 branches and a different tree
176 err = setupRepoForRebase(repo, masterCommit, branchName, commitOptions{})
177 checkFatal(t, err)
178
179 // Create several commits in emile
180 for _, commit := range emileCommits {
181 _, err = commitSomething(repo, commit, commit, commitOptions{})
182 checkFatal(t, err)
183 }
184
185 // Rebase onto master
186 rebase, err := performRebaseOnto(repo, "master", nil)
187 checkFatal(t, err)
188 defer rebase.Free()
189
190 // Open existing rebase
191 oRebase, err = repo.OpenRebase(nil)
192 checkFatal(t, err)
193 defer oRebase.Free()
194 if oRebase == nil {
195 t.Fatal("Expected to find an existing rebase in progress")
196 }
197
198 // Finish the rebase properly
199 err = rebase.Finish()
200 checkFatal(t, err)

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…