Repository navigation
feat: Add ability to delete tags locally and from remote - #22482
OmegaHawkeye wants to merge 1 commit into
Conversation
|
Thanks for your pull request! This is a large change (298 lines across 17 files) that doesn't reference a Large feature PRs require prior discussion in an issue before implementation — this helps the team assess whether the feature aligns with the project's direction before significant effort is invested. Please open an issue to discuss this feature first. This PR will be automatically closed in 3 days if requirements are not met. Full contribution requirements
|
There was a problem hiding this comment.
Pull request overview
This PR extends GitHub Desktop’s tag deletion workflow so users can delete tags locally and optionally delete them from the remote by queuing a delete refspec to be sent on the next push, with persistence via localStorage.
Changes:
- Adds support for remote tag deletions by carrying
:refs/tags/<tag>delete refspecs through the existing push flow and persisting pending deletions per repository. - Updates the delete-tag confirmation dialog to optionally request remote deletion (when applicable) and wires the option through Dispatcher → AppStore → GitStore.
- Updates UI/state plumbing to surface pending remote tag deletions (push CTA messaging, repository state, popup model) and enables “Delete tag” for all local tags.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| app/test/unit/git/tag-test.ts | Adds a unit test ensuring remote tag deletion works when pushed as a delete refspec. |
| app/test/unit/git-store-test.ts | Adds a unit test verifying GitStore queues remote deletions and they’re applied on a later push. |
| app/src/ui/history/compare.tsx | Passes a canDeleteRemote flag when opening the delete-tag dialog. |
| app/src/ui/history/commit-list.tsx | Enables “Delete tag” for all local tags (not only unpushed). |
| app/src/ui/dispatcher/dispatcher.ts | Extends deleteTag API and delete-tag popup to carry remote-delete capability. |
| app/src/ui/delete-tag/delete-tag-dialog.tsx | Adds “Remove tag from remote” checkbox and forwards option to dispatcher. |
| app/src/ui/changes/no-changes.tsx | Updates push CTA copy/conditions to include pending remote tag deletions. |
| app/src/ui/app.tsx | Wires popup prop to dialog and counts remote deletions in the push indicator count. |
| app/src/models/popup.ts | Extends DeleteTag popup detail to include canDeleteRemote. |
| app/src/lib/stores/repository-state-cache.ts | Initializes repository state with tagsToDeleteOnRemote. |
| app/src/lib/stores/repositories-store.ts | Clears persisted pending remote deletions when removing a repository. |
| app/src/lib/stores/helpers/tags-to-push-storage.ts | Adds localStorage helpers for pending remote tag deletions. |
| app/src/lib/stores/git-store.ts | Tracks pending remote tag deletions, persists them, and clears them on successful push. |
| app/src/lib/stores/app-store.ts | Plumbs state through AppStore and passes tag deletion refspecs into push operations. |
| app/src/lib/git/tag.ts | Adds a deleteRemoteTag helper and fixes deleteTag doc text. |
| app/src/lib/git/push.ts | Adds tagsToDeleteOnRemote option and appends delete refspecs to git push. |
| app/src/lib/app-state.ts | Extends repository state interface with tagsToDeleteOnRemote. |
| <DialogFooter> | ||
| <OkCancelButtonGroup destructive={true} okButtonText="Delete" /> | ||
| <OkCancelButtonGroup okButtonText="Delete" /> | ||
| </DialogFooter> |
| private onDeleteTag = (tagName: string) => { | ||
| this.props.dispatcher.showDeleteTagDialog(this.props.repository, tagName) | ||
| this.props.dispatcher.showDeleteTagDialog( | ||
| this.props.repository, | ||
| tagName, | ||
| this.props.repository.gitHubRepository !== null || | ||
| this.props.currentBranch?.upstreamRemoteName != null | ||
| ) |
| await this.refreshTags() | ||
| this.removeTagToPush(name) | ||
|
|
||
| if (removeFromRemote) { | ||
| this.addTagToDeleteOnRemote(name) | ||
| } |
|
|
||
| if (options?.tagsToDeleteOnRemote !== null) { | ||
| args.push( | ||
| ...(options?.tagsToDeleteOnRemote ?? []).map( | ||
| tagName => `:refs/tags/${tagName}` | ||
| ) | ||
| ) | ||
| } |
| export function storeTagsToDeleteOnRemote( | ||
| repository: Repository, | ||
| tagsToDeleteOnRemote: ReadonlyArray<string> | ||
| ) { | ||
| if (tagsToDeleteOnRemote.length === 0) { | ||
| clearTagsToDeleteOnRemote(repository) | ||
| } else { | ||
| setStringArray(getTagsToDeleteOnRemoteKey(repository), tagsToDeleteOnRemote) | ||
| } | ||
| } | ||
|
|
||
| export function getTagsToDeleteOnRemote(repository: Repository) { | ||
| return getStringArray(getTagsToDeleteOnRemoteKey(repository)) | ||
| } | ||
|
|
||
| export function clearTagsToDeleteOnRemote(repository: Repository) { | ||
| localStorage.removeItem(getTagsToDeleteOnRemoteKey(repository)) | ||
| } |
|
Reopening after code review fixes were applied. |
Summary
pushDeleteTagtogit/push.tsand extendsdeleteTagingit/tag.tsfor the remote delete operation.localStorageviatags-to-push-storage.tsso a network failure doesn't silently lose the intent.RepositoriesStore).CommitListso Delete tag is enabled for all local tags, not only unpushed ones.Test plan
Closes the following issue #22481 (created by me)