Pull auto-inits repo, restores files, and add -r global shorthand.

pull now works on a fresh machine: inits ~/.sgard if missing, always
pulls when local manifest is empty, and restores all files after
downloading blobs. -r is now a global shorthand for --remote; list
uses resolveRemoteConfig() like prune.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 11:57:16 -07:00
parent 57d252cee4
commit bd54491c1d
4 changed files with 26 additions and 11 deletions

View File

@@ -206,8 +206,8 @@ func (c *Client) doPull(ctx context.Context, g *garden.Garden) (int, error) {
serverManifest := server.ProtoToManifest(pullResp.GetManifest())
localManifest := g.GetManifest()
// If local is newer or equal, nothing to do.
if !serverManifest.Updated.After(localManifest.Updated) {
// If local has files and is newer or equal, nothing to do.
if len(localManifest.Files) > 0 && !serverManifest.Updated.After(localManifest.Updated) {
return 0, nil
}