Skip to content

Commit 8710283

Browse files
committed
Always call upstream git remote upstreamvcs
Instead of using various different upstream remote names, use the one and same upstream git remote name consistently. As the name pick `upstreamvcs` just as git-buildpackage does, so that if anybody runs `gbp clone` they will automatically end up with the same git remotes and branches as anyone in to go-team.
1 parent d5fd544 commit 8710283

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

make.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,14 @@ func runGitCommandIn(dir string, arg ...string) error {
418418
func createGitRepository(debsrc, gopkg, orig string, u *upstream,
419419
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string,
420420
dep14 bool, pristineTar bool) (string, error) {
421+
422+
// debianBranch is passed in function call, but upstream import branch needs
423+
// also to be defined
424+
upstreamImportBranch := "upstream"
425+
if dep14 {
426+
upstreamImportBranch = "upstream/latest"
427+
}
428+
421429
wd, err := os.Getwd()
422430
if err != nil {
423431
return "", fmt.Errorf("get cwd: %w", err)
@@ -463,7 +471,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
463471

464472
// Preconfigure branches
465473

466-
branches := []string{debianBranch, "upstream/latest"}
474+
branches := []string{debianBranch, upstreamImportBranch}
475+
467476
if pristineTar {
468477
branches = append(branches, "pristine-tar")
469478
}
@@ -477,13 +486,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
477486
}
478487

479488
if includeUpstreamHistory {
480-
u.remote, err = shortHostName(gopkg, allowUnknownHoster)
481-
if err != nil {
482-
return dir, fmt.Errorf("unable to fetch upstream history: %q", err)
483-
}
484-
if u.remote == "debian" {
485-
u.remote = "salsa"
486-
}
489+
// Always call the upstream git remote 'upstreamvcs' just like git-buildpackage does
490+
u.remote = "upstreamvcs"
487491
log.Printf("Adding remote %q with URL %q\n", u.remote, u.rr.Repo)
488492
if err := runGitCommandIn(dir, "remote", "add", u.remote, u.rr.Repo); err != nil {
489493
return dir, fmt.Errorf("git remote add %s %s: %w", u.remote, u.rr.Repo, err)
@@ -495,10 +499,13 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
495499
}
496500

497501
// Import upstream orig tarball
502+
// (and release git tag if includeUpstreamHistory)
498503

499-
arg := []string{"import-orig", "--no-interactive", "--debian-branch=" + debianBranch}
500-
if dep14 {
501-
arg = append(arg, "--upstream-branch=upstream/latest")
504+
arg := []string{
505+
"import-orig",
506+
"--no-interactive",
507+
"--debian-branch=" + debianBranch,
508+
"--upstream-branch=" + upstreamImportBranch,
502509
}
503510
if pristineTar {
504511
arg = append(arg, "--pristine-tar")

0 commit comments

Comments
 (0)