Skip to content

Feature/cmd remote remove#211

Open
bwalsh wants to merge 3 commits intomainfrom
feature/cmd-remote-remove
Open

Feature/cmd remote remove#211
bwalsh wants to merge 3 commits intomainfrom
feature/cmd-remote-remove

Conversation

@bwalsh
Copy link
Contributor

@bwalsh bwalsh commented Feb 13, 2026

Summary

This PR adds and refines support for removing Git DRS remotes, including:

  • git drs remote remove <name> with rm alias (git drs remote rm <name>).

  • Cleanup of both namespaced and legacy remote config keys.

  • Safe default-remote handling (reassign when possible, clear when last remote is removed).

  • Expanded tests for remove behavior and edge cases.

  • Documentation updates and a conversation-derived use-case guide clarifying why git remote remove does not remove Git DRS remotes.

Why

Confusing user experience. Due to missing git drs remote remove. This PR provides first-class UX for DRS remote removal and clearer guidance in docs.

Implementation Details

  • Added remove command usage/alias and error messaging at the CLI layer.

  • Registered command under git drs remote.

  • Implemented config cleanup for namespaced + legacy remote entries and default reassignment/clearing logic.

Test Coverage

  • Command tests include args validation, alias presence, successful removal, and not-found behavior.

  • Config tests include removing default, removing last remote (default clears), and legacy remote cleanup behavior.

Documentation

  • Commands reference now includes remove and rm usage/examples.

  • Added dedicated use-case doc with conversation-derived scenario (git remote remove vs git drs remote rm).

  • README now links the use-case doc and lists remote remove in command overview.

Reviewer Notes (please check docs)

Please specifically review the documentation updates for:

  • Accuracy of the user-facing command guidance in docs/commands.md.

  • Clarity of the migration/use-case narrative in docs/remote-remove-use-cases.md.

  • Consistency with README command and docs links.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive support for removing Git DRS remotes via the git drs remote remove command (with rm alias). The implementation handles both modern namespaced and legacy configuration keys, automatically reassigns the default remote when needed, and includes thorough test coverage.

Changes:

  • Added git drs remote remove <name> command with rm alias for removing configured DRS remotes
  • Implemented safe default-remote handling that automatically reassigns to another remote alphabetically or clears when last remote is removed
  • Added comprehensive unit tests covering removal scenarios, default reassignment, and legacy config cleanup
  • Updated documentation with command reference and practical use-case guide

Reviewed changes

Copilot reviewed 8 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/remote/remove.go New command implementation with argument validation and remote-not-found error handling
cmd/remote/root.go Registers RemoveCmd under the remote subcommand
config/config.go Implements RemoveRemote function with namespaced/legacy cleanup and default reassignment logic
cmd/remote/remote_test.go Command-level tests for args validation, aliases, and execution scenarios
config/config_test.go Config-level tests for default reassignment, last remote removal, and legacy cleanup
docs/commands.md Command reference documentation with usage examples
docs/remote-remove-use-cases.md Practical use-case guide with scenario-based examples
README.md Updated command list and documentation links
coverage/*.out Updated coverage files showing good test coverage for new code

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@lbeckman314 lbeckman314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Steps 🌀

1. Install

➜ git checkout feature/cmd-remote-remove

➜ git show --summary --oneline
22c6ff4 (HEAD -> feature/cmd-remote-remove, origin/feature/cmd-remote-remove) Update docs/remote-remove-use-cases.md

➜ make install

➜ which git-drs
$HOME/go/bin/git-drs

➜ git-drs version
git-drs v0.5.16-0.20260213164041-22c6ff45e179+dirty-22c6ff4

2. Initialize Repo

cd /tmp

➜ mkdir testing

➜ cd testing

➜ git init

➜ git drs init

3. Add Remote

➜ git drs remote add gen3 example --bucket example --project example --cred ~/.gen3/credentials.json.calypr-dev

➜ git drs remote list
* example    gen3     https://calypr-dev.ohsu.edu

4. Remove Remote

➜ git drs remote rm example

➜ git drs remote list
<EMPTY>

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.

2 participants