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

Method TestEncodeWithoutSignature

plumbing/object/commit_test.go:753–1008  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

751}
752
753func (s *SuiteCommit) TestEncodeWithoutSignature(c *C) {
754 tests := []struct {
755 name string
756 commitRaw string
757 mutate func(*Commit)
758 expected string
759 }{
760 {
761 name: "commit without signature",
762 commitRaw: `tree eba74343e2f15d62adedfd8c883ee0262b5c8021
763parent 35e85108805c84807bc66a02d91535e1e24b38b9
764parent a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69
765author Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200
766committer Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200
767
768Merge branch 'master' of github.com:tyba/git-fixture
769`,
770 expected: `tree eba74343e2f15d62adedfd8c883ee0262b5c8021
771parent 35e85108805c84807bc66a02d91535e1e24b38b9
772parent a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69
773author Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200
774committer Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200
775
776Merge branch 'master' of github.com:tyba/git-fixture
777`,
778 },
779 {
780 name: "commit with change-id and gpgsig",
781 commitRaw: `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
782author John Doe <john.doe@example.com> 1755280730 -0700
783committer John Doe <john.doe@example.com> 1755280730 -0700
784change-id wxmuynokkzxmuwxwvnnpnptoyuypknwv
785gpgsig -----BEGIN PGP SIGNATURE-----
786 iHUEABMIAB0WIQSZpnSpGKbQbDaLe5iiNQl48cTY5gUCaJ91XQAKCRCiNQl48cTY
787 5vCYAP9Sf1yV9oUviRIxEA+4rsGIx0hI6kqFajJ/3TtBjyCTggD+PFnKOxdXeFL2
788 GLwcCzFIsmQmkLxuLypsg+vueDSLpsM=
789 =VucY
790 -----END PGP SIGNATURE-----
791
792initial commit
793
794Change-Id: I6a6a696432d51cbff02d53234ccaca6b151afc34
795`,
796 expected: `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
797author John Doe <john.doe@example.com> 1755280730 -0700
798committer John Doe <john.doe@example.com> 1755280730 -0700
799change-id wxmuynokkzxmuwxwvnnpnptoyuypknwv
800
801initial commit
802
803Change-Id: I6a6a696432d51cbff02d53234ccaca6b151afc34
804`,
805 },
806 {
807 name: "gpgsig-sha256",
808 commitRaw: `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
809author John Doe <john.doe@example.com> 1755280730 -0700
810committer John Doe <john.doe@example.com> 1755280730 -0700

Callers

nothing calls this directly

Calls 6

SetTypeMethod · 0.95
WriteMethod · 0.95
ReaderMethod · 0.95
DecodeCommitFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected