Drop the "not cloned here" line from overview
It answered a question `list` already answers, and it did so on every run: the point of the overview is the state of the projects you have, not a second listing of the server. reportInventory became reportUnpublished and now reports one thing -- the local projects the server has never seen, which are the ones `init` is for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+17
-8
@@ -82,11 +82,11 @@ func TestCommitHostRe(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestReportInventoryUnreachableServer: when the server cannot be listed, the
|
||||
// TestReportUnpublishedUnreachableServer: when the server cannot be listed, the
|
||||
// overview must say so rather than claim every project is missing there.
|
||||
func TestReportInventoryUnreachableServer(t *testing.T) {
|
||||
func TestReportUnpublishedUnreachableServer(t *testing.T) {
|
||||
out := captureStdout(t, func() {
|
||||
reportInventory([]string{"a", "b"}, nil, errors.New("network is unreachable"))
|
||||
reportUnpublished([]string{"a", "b"}, nil, errors.New("network is unreachable"))
|
||||
})
|
||||
if strings.Contains(out, "not on the server") {
|
||||
t.Errorf("an unreachable server was reported as missing repositories: %q", out)
|
||||
@@ -96,20 +96,29 @@ func TestReportInventoryUnreachableServer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestReportInventorySplitsSides is the join that plain git cannot do.
|
||||
func TestReportInventorySplitsSides(t *testing.T) {
|
||||
// TestReportUnpublished names only the local projects the server has never
|
||||
// seen. The other direction — repositories there but not here — is what `list`
|
||||
// is for, and repeating it here only added noise.
|
||||
func TestReportUnpublished(t *testing.T) {
|
||||
out := captureStdout(t, func() {
|
||||
reportInventory([]string{"both", "onlyhere"}, []string{"both", "onlythere"}, nil)
|
||||
reportUnpublished([]string{"both", "onlyhere"}, []string{"both", "onlythere"}, nil)
|
||||
})
|
||||
if !strings.Contains(out, "not on the server (init)") || !strings.Contains(out, "onlyhere") {
|
||||
t.Errorf("local-only project not reported: %q", out)
|
||||
}
|
||||
if !strings.Contains(out, "not cloned here (clone)") || !strings.Contains(out, "onlythere") {
|
||||
t.Errorf("server-only project not reported: %q", out)
|
||||
if strings.Contains(out, "onlythere") {
|
||||
t.Errorf("server-only project should no longer be listed: %q", out)
|
||||
}
|
||||
if strings.Contains(out, "both") {
|
||||
t.Errorf("a project present on both sides should not be listed: %q", out)
|
||||
}
|
||||
|
||||
// nothing unpublished: no line at all, not an empty label
|
||||
if out := captureStdout(t, func() {
|
||||
reportUnpublished([]string{"both"}, []string{"both"}, nil)
|
||||
}); strings.TrimSpace(out) != "" {
|
||||
t.Errorf("nothing to report should print nothing, got %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShortAge(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user