Fix follow-up tag sync after branch bootstrap · Entire
Fix follow-up tag sync after branch bootstrap
81ac0ff→main·
Soph·3mo ago·4 files·+222 added/-0 removed
Sessions
ce50cf769213View transcript
[?
can you look at the changes in this branch, I want to run the smoke test against a local entire using the linux repo. I did it run once before and it seems no matter what I do it just finishs quicklyCodex·GPT-5.4·5 steps](/content/gh/entireio/git-sync/session/019d7739-95cb-79e3-9de4-3cbe15400b87#timeline-ce50cf769213/index.html)
Changes
4
internal/syncer
Mintegration_test.go+113
Mprotocol_v2.go+3
Mprotocol_v2_test.go+30
Msyncer.go+76
21 unmodified lines
22
23
24
25
26
27
28
733 unmodified lines
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
138 unmodified lines
1014
1015
1016
1017
1018
1019
1020
151 unmodified lines
1172
1173
1174
1175
1176
1177
1178
1179
1180
21 unmodified lines
"github.com/go-git/go-git/v5/plumbing/format/pktline"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/protocol/packp"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
"github.com/go-git/go-git/v5/plumbing/revlist"
"github.com/go-git/go-git/v5/plumbing/transport"
transportclient "github.com/go-git/go-git/v5/plumbing/transport/client"
733 unmodified lines
assertHeadsMatch(t, sourceRepo, targetRepo, testBranch)
}
func TestRun_IntegrationAddAnnotatedTagAfterInitialBranchSync(t *testing.T) {
sourceRepo, sourceFS := newSourceRepo(t)
makeCommits(t, sourceRepo, sourceFS, 2)
targetRepo, err := git.Init(memory.NewStorage(), nil)
if err != nil {
t.Fatalf("init target repo: %v", err)
}
sourceServer := newSmartHTTPRepoServerV2(t, sourceRepo)
targetServer := newSmartHTTPRepoServer(t, targetRepo)
defer sourceServer.Close()
defer targetServer.Close()
if _, err := Run(context.Background(), Config{
Source: Endpoint{URL: sourceServer.RepoURL()},
Target: Endpoint{URL: targetServer.RepoURL()},
ProtocolMode: protocolModeV2,
}); err != nil {
t.Fatalf("initial branch sync failed: %v", err)
}
head, err := sourceRepo.Reference(plumbing.NewBranchReferenceName(testBranch), true)
if err != nil {
t.Fatalf("source head: %v", err)
}
if _, err := sourceRepo.CreateTag("annotated-v1", head.Hash(), &git.CreateTagOptions{
Tagger: &objectSignature,
Message: "annotated release",
}); err != nil {
t.Fatalf("create annotated tag: %v", err)
}
result, err := Run(context.Background(), Config{
Source: Endpoint{URL: sourceServer.RepoURL()},
Target: Endpoint{URL: targetServer.RepoURL()},
ProtocolMode: protocolModeV2,
IncludeTags: true,
})
if err != nil {
t.Fatalf("annotated tag follow-up sync failed: %v", err)
}
if result.Pushed == 0 {
t.Fatalf("expected follow-up sync to push annotated tag, got %+v", result)
}
if _, err := targetRepo.Reference(plumbing.NewTagReferenceName("annotated-v1"), true); err != nil {
t.Fatalf("expected annotated tag on target: %v", err)
}
}
func TestRun_IntegrationAddHistoricalAnnotatedTagAfterInitialBranchSync_NoThinTarget(t *testing.T) {
sourceRepo, sourceFS := newSourceRepo(t)
makeCommits(t, sourceRepo, sourceFS, 4)
targetRepo, err := git.Init(memory.NewStorage(), nil)
if err != nil {
t.Fatalf("init target repo: %v", err)
}
sourceServer := newSmartHTTPRepoServerV2(t, sourceRepo)
targetServer := newSmartHTTPRepoServer(t, targetRepo)
targetServer.receivePackNoThin = true
defer sourceServer.Close()
defer targetServer.Close()
head, err := sourceRepo.Reference(plumbing.NewBranchReferenceName(testBranch), true)
if err != nil {
t.Fatalf("source head: %v", err)
}
chain, err := firstParentChain(sourceRepo, head.Hash())
if err != nil {
t.Fatalf("build commit chain: %v", err)
}
if len(chain) < 2 {
t.Fatalf("expected historical commit chain, got %d", len(chain))
}
if _, err := sourceRepo.CreateTag("annotated-old", chain[1], &git.CreateTagOptions{
Tagger: &objectSignature,
Message: "historical release",
}); err != nil {
t.Fatalf("create historical annotated tag: %v", err)
}
result, err := Run(context.Background(), Config{
Source: Endpoint{URL: sourceServer.RepoURL()},
Target: Endpoint{URL: targetServer.RepoURL()},
ProtocolMode: protocolModeV2,
IncludeTags: true,
})
if err != nil {
t.Fatalf("historical annotated tag follow-up sync failed: %v", err)
}
if result.Pushed == 0 {
t.Fatalf("expected follow-up sync to push historical annotated tag, got %+v", result)
}
if _, err := targetRepo.Reference(plumbing.NewTagReferenceName("annotated-old"), true); err != nil {
t.Fatalf("expected historical annotated tag on target: %v", err)
}
}
func newSourceRepo(t *testing.T) (*git.Repository, billy.Filesystem) {
t.Helper()
138 unmodified lines
password string
receivePackBodyLimit int64
receivePackNoThin bool
mu sync.Mutex
metrics []exchangeMetric
151 unmodified lines
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if service == serviceReceivePack && s.receivePackNoThin {
_ = ar.Capabilities.Set(capability.Capability("no-thin"))
}
ar.Prefix = [][]byte{
[]byte("# service=" + service),