Clarify linkage between git.remote and drs.remote in pre-push hook
--
Problem
There appears to be an implied linkage between git.remote and drs.remote, but it’s not clear what that linkage is, when it should apply, or why it should be enforced. This ambiguity makes it difficult to reason about correct behavior when pushing to named remotes vs. ad-hoc URLs.
Context: Pre-push hook arguments
Git’s pre-push hook always receives two parameters:
- The name of the remote (e.g.,
origin)
- The remote URL/location (e.g.,
git@github.com:user/repo.git)
If Git can’t determine a named remote (e.g., push directly to a URL), it passes the URL for both parameters. Examples:
Open questions
- What is the intended relationship between
git.remote and drs.remote?
- Under what conditions should a mismatch be enforced vs. allowed?
- How should the system behave when
$1 == $2 (ad-hoc URL push)?
Relevant code
config.GetRemote (8 usages):
|
func (c Config) GetRemote(remote Remote) DRSRemote { |
config.GetDefaultRemote (1 usage):
|
func (c Config) GetDefaultRemote() (Remote, error) { |
Expected outcome
Document (or implement) the intended linkage behavior between git.remote and drs.remote, including edge cases like ad-hoc URL pushes where $1 == $2.
Clarify linkage between
git.remoteanddrs.remotein pre-push hook--
Problem
There appears to be an implied linkage between
git.remoteanddrs.remote, but it’s not clear what that linkage is, when it should apply, or why it should be enforced. This ambiguity makes it difficult to reason about correct behavior when pushing to named remotes vs. ad-hoc URLs.Context: Pre-push hook arguments
Git’s
pre-pushhook always receives two parameters:origin)git@github.com:user/repo.git)If Git can’t determine a named remote (e.g., push directly to a URL), it passes the URL for both parameters. Examples:
git push git@github.com:user/repo.git maingit push https://github.com/user/repo.git maingit push /path/to/another/repo.git mainReference: https://git-scm.com/docs/githooks/2.2.3
Open questions
git.remoteanddrs.remote?$1 == $2(ad-hoc URL push)?Relevant code
config.GetRemote(8 usages):git-drs/config/config.go
Line 85 in 7eca2be
config.GetDefaultRemote(1 usage):git-drs/config/config.go
Line 99 in 7eca2be
Expected outcome
Document (or implement) the intended linkage behavior between
git.remoteanddrs.remote, including edge cases like ad-hoc URL pushes where$1 == $2.