MCPcopy Create free account
hub / github.com/go-git/go-git / TestCommitTreeSort

Method TestCommitTreeSort

worktree_commit_test.go:397–442  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

395}
396
397func (s *WorktreeSuite) TestCommitTreeSort(c *C) {
398 fs, clean := s.TemporalFilesystem()
399 defer clean()
400
401 st := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
402 _, err := Init(st, nil)
403 c.Assert(err, IsNil)
404
405 r, _ := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
406 URL: fs.Root(),
407 })
408
409 w, err := r.Worktree()
410 c.Assert(err, IsNil)
411
412 mfs := w.Filesystem
413
414 err = mfs.MkdirAll("delta", 0755)
415 c.Assert(err, IsNil)
416
417 for _, p := range []string{"delta_last", "Gamma", "delta/middle", "Beta", "delta-first", "alpha"} {
418 util.WriteFile(mfs, p, []byte("foo"), 0644)
419 _, err = w.Add(p)
420 c.Assert(err, IsNil)
421 }
422
423 _, err = w.Commit("foo\n", &CommitOptions{
424 All: true,
425 Author: defaultSignature(),
426 })
427 c.Assert(err, IsNil)
428
429 err = r.Push(&PushOptions{})
430 c.Assert(err, IsNil)
431
432 cmd := exec.Command("git", "fsck")
433 cmd.Dir = fs.Root()
434 cmd.Env = os.Environ()
435 buf := &bytes.Buffer{}
436 cmd.Stderr = buf
437 cmd.Stdout = buf
438
439 err = cmd.Run()
440
441 c.Assert(err, IsNil, Commentf("%s", buf.Bytes()))
442}
443
444// https://github.com/go-git/go-git/pull/224
445func (s *WorktreeSuite) TestJustStoreObjectsNotAlreadyStored(c *C) {

Callers

nothing calls this directly

Calls 15

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
NewStorageFunction · 0.92
InitFunction · 0.85
CloneFunction · 0.85
defaultSignatureFunction · 0.85
RootMethod · 0.80
WorktreeMethod · 0.80
MkdirAllMethod · 0.80
CommitMethod · 0.65
PushMethod · 0.65
CommandMethod · 0.65

Tested by

no test coverage detected