mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-27 03:21:25 +01:00
fix(repo): keep pushes from a cloned fork on the fork
Cloning a fork pointed the default branch at the upstream remote, so a plain `git push` targeted the parent repository. The branch still pulls from upstream, which keeps tea targeting the parent, but now sets branch.<default>.pushRemote=origin so pushes go to the fork. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
2 files changed
+8
-6
No files matched your search
@@ -100,6 +100,7 @@ func TestCloneAddsUpstreamRemoteForForks(t *testing.T) {
|
||||
"remote add -- upstream " + parent: "",
|
||||
"config branch.main.remote upstream": "",
|
||||
"config branch.main.merge refs/heads/main": "",
|
||||
"config branch.main.pushRemote origin": "",
|
||||
}}
|
||||
deps.Git = runner
|
||||
cwd := t.TempDir()
|
||||
@@ -109,9 +110,10 @@ func TestCloneAddsUpstreamRemoteForForks(t *testing.T) {
|
||||
"remote add -- upstream " + parent,
|
||||
"config branch.main.remote upstream",
|
||||
"config branch.main.merge refs/heads/main",
|
||||
"config branch.main.pushRemote origin",
|
||||
}, runner.calls)
|
||||
clone := filepath.Join(cwd, "destination")
|
||||
require.Equal(t, []string{cwd, clone, clone, clone}, runner.dirs)
|
||||
require.Equal(t, []string{cwd, clone, clone, clone, clone}, runner.dirs)
|
||||
require.JSONEq(t, `{"id":8,"full_name":"bob/project","fork":true}`, out.String())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user