Fix issues with remote templates without branch#70
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.