@@ -417,6 +417,14 @@ func runGitCommandIn(dir string, arg ...string) error {
417
417
418
418
func createGitRepository (debsrc , gopkg , orig string , u * upstream ,
419
419
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
+
420
428
wd , err := os .Getwd ()
421
429
if err != nil {
422
430
return "" , fmt .Errorf ("get cwd: %w" , err )
@@ -471,7 +479,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
471
479
472
480
// Preconfigure branches
473
481
474
- branches := []string {debianBranch , "upstream/latest" }
482
+ branches := []string {debianBranch , upstreamImportBranch }
483
+
475
484
if pristineTar {
476
485
branches = append (branches , "pristine-tar" )
477
486
}
@@ -485,13 +494,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
485
494
}
486
495
487
496
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"
495
499
log .Printf ("Adding remote %q with URL %q\n " , u .remote , u .rr .Repo )
496
500
if err := runGitCommandIn (dir , "remote" , "add" , u .remote , u .rr .Repo ); err != nil {
497
501
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,
503
507
}
504
508
505
509
// Import upstream orig tarball
510
+ // (and release git tag if includeUpstreamHistory)
506
511
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 ,
510
517
}
511
518
if pristineTar {
512
519
arg = append (arg , "--pristine-tar" )
0 commit comments