Skip to content

Add configurable default remote - #160

Merged
andrew merged 3 commits into
git-pkgs:mainfrom
abhinavgautam01:feat/configurable-remote
Sep 2, 2026
Merged

Add configurable default remote#160
andrew merged 3 commits into
git-pkgs:mainfrom
abhinavgautam01:feat/configurable-remote

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Fixes #113

Summary

  • add support for a remote setting in the [default] config section
  • use the configured remote when --remote is not provided
  • preserve precedence as --remote > configured remote > origin
  • support the setting in both user config and project .forge files
  • document the new setting and add tests for configuration merging and CLI precedence

Testing

  • go build ./...
  • go test -race ./...
  • go tool golangci-lint run ./...
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown

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 a configurable default git remote name to Forge’s configuration system and updates CLI behavior so repo resolution uses the configured remote when --remote is not provided, falling back to origin.

Changes:

  • Added remote support in the [default] config section and ensured it merges correctly between user config and project .forge.
  • Updated CLI remote selection to follow precedence: --remote > configured remote > origin.
  • Documented the new setting and added tests covering config merging and CLI precedence.

Reviewed changes

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

Show a summary per file
File Description
README.md Documents the new [default] remote setting and precedence behavior.
internal/config/config.go Adds DefaultSection.Remote and loads remote from config files.
internal/config/config_test.go Extends config parsing/merge tests to cover the remote setting.
internal/cli/root.go Implements runtime remote precedence and updates --remote help text.
internal/cli/root_test.go Adds a test verifying CLI precedence between config, flag, and fallback.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/cli/root.go Outdated

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please address these before merging:

  • Add a test that runs through rootCmd.Execute() with a realistic Git repository and covers the configured remote, the --remote override, and the origin fallback. The current test calls PersistentPreRun directly and only inspects internal state.
  • Update the comment on resolve.Repo; it still says the fallback reads origin, though it can now read the configured remote.

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

Thanks, Addressed both items. The remote precedence test now runs through rootCmd.Execute() using a real temporary Git repository and covers the configured remote, --remote override and origin fallback. I also updated the resolve.Repo comment.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The requested CLI-boundary coverage is in place, the documentation is current, and the remote precedence works through the production command path.

@andrew
andrew merged commit 41f408d into git-pkgs:main Sep 2, 2026
4 checks passed
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.

Add a remote name to config

3 participants