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:
2026-07-26 17:45:02 +02:00
co-authored by Claude Opus 5
parent cb1ff98c3d
commit 8ca05d6ad2
4 changed files with 37 additions and 45 deletions
+14 -31
View File
@@ -5,9 +5,8 @@ package main
// mgsh is the only thing that sees all three places a project can live: the
// local base directory, the internal ssh server, and the public mirrors. Joining
// those answers the questions plain git cannot — which projects were never
// pushed to the server, which exist there but not on this machine, and which
// machine last touched each one (every `push` stamps "[user@host]" into the
// commit message, so that comes for free).
// pushed to the server, and which machine last touched each one (every `push`
// stamps "[user@host]" into the commit message, so that comes for free).
import (
"fmt"
@@ -99,7 +98,7 @@ func overviewAll() {
len(rows), dirtyN, syncN)))
}
reportInventory(local, srv.names, srv.err)
reportUnpublished(local, srv.names, srv.err)
}
// scanProjects collects the state of every project concurrently. Each project
@@ -121,47 +120,31 @@ func scanProjects(names []string) []projStatus {
return rows
}
// reportInventory names the projects that live on only one side: local ones the
// server has never seen (candidates for `init`) and server repositories missing
// here (candidates for `clone`).
func reportInventory(local, server []string, err error) {
// reportUnpublished names the local projects the git server has never seen —
// the ones `init` is for. The reverse direction, server repositories missing
// here, is what `list` is for and is not repeated.
func reportUnpublished(local, server []string, err error) {
if err != nil {
fmt.Println(col(cGray, " git server not reachable — local view only"))
return
}
have := map[string]bool{}
for _, n := range local {
have[n] = true
}
onServer := map[string]bool{}
for _, n := range server {
onServer[n] = true
}
var missingRemote, missingLocal []string
var missing []string
for _, n := range local {
if !onServer[n] {
missingRemote = append(missingRemote, n)
missing = append(missing, n)
}
}
for _, n := range server {
if !have[n] {
missingLocal = append(missingLocal, n)
}
}
sort.Strings(missingRemote)
sort.Strings(missingLocal)
// the two labels share a column so their contents line up as well
const labelW = 24
if len(missingRemote) > 0 {
fmt.Printf(" %s %s\n", col(cYellow, padRight("not on the server (init)", labelW)),
col(cGray, strings.Join(missingRemote, ", ")))
}
if len(missingLocal) > 0 {
fmt.Printf(" %s %s\n", col(cCyan, padRight("not cloned here (clone)", labelW)),
col(cGray, strings.Join(missingLocal, ", ")))
if len(missing) == 0 {
return
}
sort.Strings(missing)
fmt.Printf(" %s %s\n", col(cYellow, "not on the server (init)"),
col(cGray, strings.Join(missing, ", ")))
}
// projectStatus gathers the git state of a single project directory.