Skip to content

Commit 7040600

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 79a2cc6 commit 7040600

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
@@ -417,6 +417,14 @@ func runGitCommandIn(dir string, arg ...string) error {
417417

418418
func createGitRepository(debsrc, gopkg, orig string, u *upstream,
419419
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, dep14 bool, pristineTar bool) (string, error) {
420+
421+
// debianBranch is passed in function call, but upstream import branch needs
422+
// also to be defined
423+
upstreamImportBranch := "upstream"
424+
if dep14 {
425+
upstreamImportBranch = "upstream/latest"
426+
}
427+
420428
wd, err := os.Getwd()
421429
if err != nil {
422430
return "", fmt.Errorf("get cwd: %w", err)
@@ -471,7 +479,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
471479

472480
// Preconfigure branches
473481

474-
branches := []string{debianBranch, "upstream/latest"}
482+
branches := []string{debianBranch, upstreamImportBranch}
483+
475484
if pristineTar {
476485
branches = append(branches, "pristine-tar")
477486
}
@@ -485,13 +494,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
485494
}
486495

487496
if includeUpstreamHistory {
488-
u.remote, err = shortHostName(gopkg, allowUnknownHoster)
489-
if err != nil {
490-
return dir, fmt.Errorf("unable to fetch upstream history: %q", err)
491-
}
492-
if u.remote == "debian" {
493-
u.remote = "salsa"
494-
}
497+
// Always call the upstream git remote 'upstreamvcs' just like git-buildpackage does
498+
u.remote = "upstreamvcs"
495499
log.Printf("Adding remote %q with URL %q\n", u.remote, u.rr.Repo)
496500
if err := runGitCommandIn(dir, "remote", "add", u.remote, u.rr.Repo); err != nil {
497501
return dir, fmt.Errorf("git remote add %s %s: %w", u.remote, u.rr.Repo, err)
@@ -503,10 +507,13 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
503507
}
504508

505509
// Import upstream orig tarball
510+
// (and release git tag if includeUpstreamHistory)
506511

507-
arg := []string{"import-orig", "--no-interactive", "--debian-branch=" + debianBranch}
508-
if dep14 {
509-
arg = append(arg, "--upstream-branch=upstream/latest")
512+
arg := []string{
513+
"import-orig",
514+
"--no-interactive",
515+
"--debian-branch=" + debianBranch,
516+
"--upstream-branch=" + upstreamImportBranch,
510517
}
511518
if pristineTar {
512519
arg = append(arg, "--pristine-tar")

0 commit comments

Comments
 (0)