MCPcopy
hub / github.com/go-git/go-git / TestCommitTreeSort

Method TestCommitTreeSort

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

Source from the content-addressed store, hash-verified

515}
516
517func (s *WorktreeSuite) TestCommitTreeSort(c *C) {
518 fs := s.TemporalFilesystem(c)
519
520 st := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
521 _, err := Init(st, nil)
522 c.Assert(err, IsNil)
523
524 r, _ := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
525 URL: fs.Root(),
526 })
527
528 w, err := r.Worktree()
529 c.Assert(err, IsNil)
530
531 mfs := w.Filesystem
532
533 err = mfs.MkdirAll("delta", 0755)
534 c.Assert(err, IsNil)
535
536 for _, p := range []string{"delta_last", "Gamma", "delta/middle", "Beta", "delta-first", "alpha"} {
537 util.WriteFile(mfs, p, []byte("foo"), 0644)
538 _, err = w.Add(p)
539 c.Assert(err, IsNil)
540 }
541
542 _, err = w.Commit("foo\n", &CommitOptions{
543 All: true,
544 Author: defaultSignature(),
545 })
546 c.Assert(err, IsNil)
547
548 err = r.Push(&PushOptions{})
549 c.Assert(err, IsNil)
550
551 cmd := exec.Command("git", "fsck")
552 cmd.Dir = fs.Root()
553 cmd.Env = os.Environ()
554 buf := &bytes.Buffer{}
555 cmd.Stderr = buf
556 cmd.Stdout = buf
557
558 err = cmd.Run()
559
560 c.Assert(err, IsNil, Commentf("%s", buf.Bytes()))
561}
562
563// https://github.com/go-git/go-git/pull/224
564func (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
CommitMethod · 0.65
PushMethod · 0.65
CommandMethod · 0.65
TemporalFilesystemMethod · 0.45

Tested by

no test coverage detected