Skip to content

Commit 5954ec7

Browse files
committed
Preconfigure git branches
just as "git clone" and "gbp clone" would do.
1 parent ea67178 commit 5954ec7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

make.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
411411
return dir, err
412412
}
413413

414+
// [remote "origin"]
415+
414416
originURL := "[email protected]:go-team/packages/" + debsrc + ".git"
415417
log.Printf("Adding remote \"origin\" with URL %q\n", originURL)
416418
if err := runGitCommandIn(dir, "remote", "add", "origin", originURL); err != nil {
@@ -423,6 +425,27 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
423425
return dir, err
424426
}
425427

428+
// Preconfigure branches
429+
430+
var debianBranch string
431+
if dep14 {
432+
debianBranch = "debian/sid"
433+
} else {
434+
debianBranch = "master"
435+
}
436+
branches := []string{debianBranch, "upstream"}
437+
if pristineTar {
438+
branches = append(branches, "pristine-tar")
439+
}
440+
for _, branch := range branches {
441+
if err := runGitCommandIn(dir, "config", "branch."+branch+".remote", "origin"); err != nil {
442+
return dir, err
443+
}
444+
if err := runGitCommandIn(dir, "config", "branch."+branch+".merge", "refs/heads/"+branch); err != nil {
445+
return dir, err
446+
}
447+
}
448+
426449
if includeUpstreamHistory {
427450
u.remote, err = shortHostName(gopkg, allowUnknownHoster)
428451
if err != nil {

0 commit comments

Comments
 (0)