mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
gitutil: find default remote by tracking branch
Using this command resolves remote based on remote tracking branch of the curently selected branch and should be more precise in case we can't predict if user uses origin to mark upstream or their fork. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@ -52,6 +52,15 @@ func GitSetRemote(c *Git, tb testing.TB, name string, url string) {
|
||||
require.NoError(tb, err)
|
||||
}
|
||||
|
||||
func GitSetMainUpstream(c *Git, tb testing.TB, remote, target string) {
|
||||
tb.Helper()
|
||||
_, err := fakeGit(c, "fetch", "--depth", "1", remote, target)
|
||||
require.NoError(tb, err)
|
||||
|
||||
_, err = fakeGit(c, "branch", "--set-upstream-to", remote+"/"+target, "main")
|
||||
require.NoError(tb, err)
|
||||
}
|
||||
|
||||
func Mktmp(tb testing.TB) string {
|
||||
tb.Helper()
|
||||
folder := tb.TempDir()
|
||||
|
Reference in New Issue
Block a user