Skip to content

Fix issues with remote templates without branch#70

Merged
Ilyes512 merged 2 commits into
mainfrom
fix-issues-with-remote-templates-without-branch
May 16, 2026
Merged

Fix issues with remote templates without branch#70
Ilyes512 merged 2 commits into
mainfrom
fix-issues-with-remote-templates-without-branch

Conversation

@Ilyes512
Copy link
Copy Markdown
Member

No description provided.

Ilyes512 and others added 2 commits May 16, 2026 17:54
…sage

Two bugs in `specs template update`:

1. Templates downloaded without an explicit branch (e.g. `github:owner/repo`)
   stored `Branch: ""` in metadata. The update/upgrade loop skipped them with
   `continue`, so new remote commits were never detected.

2. When a single named template was checked and found up-to-date, the output
   still said "all templates are up-to-date" instead of naming the template.

Fixes:
- Add `git.CurrentBranch(dir)` to resolve the checked-out branch from local
  HEAD when metadata has an empty Branch field.
- `template download`: after cloning with no branch spec, persist the resolved
  branch so subsequent update/upgrade runs work without the fallback.
- `template update`: resolve branch from local HEAD when metadata.Branch is
  empty; persist it back; track `checkedCount` and only show a message when
  something was actually checked; show `"template %q is up-to-date"` for a
  single named template.
- `registry.Upgrade`: same branch-resolution fallback so upgrade also works
  for templates downloaded without an explicit branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Templates downloaded without an explicit branch stored Branch:"" in
metadata. template_list.go had the same guard as template_update.go
(`meta.Branch != ""`), so those templates were treated as local-only
and their status column always showed "-" instead of the real remote
status.

Apply the same CurrentBranch fallback in the initial load loop: when
Branch is empty but Repository is set, resolve the branch from the
local git HEAD, persist it back to metadata, and let the rest of the
list/refresh pipeline proceed normally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Ilyes512 Ilyes512 marked this pull request as ready for review May 16, 2026 16:46
@Ilyes512 Ilyes512 merged commit 9da0a4c into main May 16, 2026
1 check passed
@Ilyes512 Ilyes512 deleted the fix-issues-with-remote-templates-without-branch branch May 16, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant