diff options
| author | Shulhan <m.shulhan@gmail.com> | 2024-07-21 03:48:32 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-04-09 22:20:06 +0700 |
| commit | 31f678e5a420fecf567c30bc66e40b43ad85fd17 (patch) | |
| tree | e3b1a4b83fb4db9e2dde3d3846966240e3b5e618 /git-codereview/mail.go | |
| parent | 99962d5770bded6aa8fac22d4c74103b5f832d6d (diff) | |
| download | go-x-review-31f678e5a420fecf567c30bc66e40b43ad85fd17.tar.xz | |
For the git-codereview commands to works on any Go's repositories, the
remote name for "origin" must be pointed to the Go original repository URL
(in most cases the one with go.googlesource.com domain).
The problem is when the "origin" is from the fork, all of the
git-codereview commands then will not works.
For example, in computer X, I clone the this repository from
"https://go.googlesource.com/review" (the origin) and then push my
changes on "git@git.sr.ht:~shulhan/go-x-review" (the fork).
In another computer Y, I then clone from the fork to continue my works.
The fork become origin.
One of the solution is to rename the remote names manually each time we
clone the fork.
The only cons using this solution is every time new branch created we need
to remember to pass "--set-upstream" during git push.
This changes introduce "remote" configuration in codereview.cfg.
When one first working on fork of Go repository, they set the "remote"
key, commit it, and push it.
When they cloned the fork, they did not needs to changes anything except
adding new remote using the pre-defined name.
Change-Id: I335d08fd8b7efe17ba07b3c0a3794f9ccf59b339
Diffstat (limited to 'git-codereview/mail.go')
| -rw-r--r-- | git-codereview/mail.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/git-codereview/mail.go b/git-codereview/mail.go index c0592bf..98de7fa 100644 --- a/git-codereview/mail.go +++ b/git-codereview/mail.go @@ -175,7 +175,7 @@ func cmdMail(args []string) { if *noverify { args = append(args, "--no-verify") } - args = append(args, "origin", refSpec) + args = append(args, config()["remote"], refSpec) run("git", args...) // Create local tag for mailed change. @@ -199,7 +199,7 @@ func (b *Branch) PushSpec(c *Commit) string { if c != nil && (len(b.Pending()) == 0 || b.Pending()[0].Hash != c.Hash) { local = c.ShortHash } - return local + ":refs/for/" + strings.TrimPrefix(b.OriginBranch(), "origin/") + return local + ":refs/for/" + strings.TrimPrefix(b.OriginBranch(), config()["remote"]+"/") } // mailAddressRE matches the mail addresses we admit. It's restrictive but admits |
