@@ -419,6 +419,14 @@ func runGitCommandIn(dir string, arg ...string) error {
419
419
func createGitRepository (debsrc , gopkg , orig string , u * upstream ,
420
420
includeUpstreamHistory bool , allowUnknownHoster bool , debianBranch string ,
421
421
dep14 bool , pristineTar bool ) (string , error ) {
422
+
423
+ // debianBranch is passed in function call, but upstream import branch needs
424
+ // also to be defined
425
+ upstreamImportBranch := "upstream"
426
+ if dep14 {
427
+ upstreamImportBranch = "upstream/latest"
428
+ }
429
+
422
430
wd , err := os .Getwd ()
423
431
if err != nil {
424
432
return "" , fmt .Errorf ("get cwd: %w" , err )
@@ -464,7 +472,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
464
472
465
473
// Preconfigure branches
466
474
467
- branches := []string {debianBranch , "upstream/latest" }
475
+ branches := []string {debianBranch , upstreamImportBranch }
476
+
468
477
if pristineTar {
469
478
branches = append (branches , "pristine-tar" )
470
479
}
@@ -478,13 +487,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
478
487
}
479
488
480
489
if includeUpstreamHistory {
481
- u .remote , err = shortHostName (gopkg , allowUnknownHoster )
482
- if err != nil {
483
- return dir , fmt .Errorf ("unable to fetch upstream history: %q" , err )
484
- }
485
- if u .remote == "debian" {
486
- u .remote = "salsa"
487
- }
490
+ // Always call the upstream git remote 'upstreamvcs' just like git-buildpackage does
491
+ u .remote = "upstreamvcs"
488
492
log .Printf ("Adding remote %q with URL %q\n " , u .remote , u .rr .Repo )
489
493
if err := runGitCommandIn (dir , "remote" , "add" , u .remote , u .rr .Repo ); err != nil {
490
494
return dir , fmt .Errorf ("git remote add %s %s: %w" , u .remote , u .rr .Repo , err )
@@ -496,10 +500,13 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
496
500
}
497
501
498
502
// Import upstream orig tarball
503
+ // (and release git tag if includeUpstreamHistory)
499
504
500
- arg := []string {"import-orig" , "--no-interactive" , "--debian-branch=" + debianBranch }
501
- if dep14 {
502
- arg = append (arg , "--upstream-branch=upstream/latest" )
505
+ arg := []string {
506
+ "import-orig" ,
507
+ "--no-interactive" ,
508
+ "--debian-branch=" + debianBranch ,
509
+ "--upstream-branch=" + upstreamImportBranch ,
503
510
}
504
511
if pristineTar {
505
512
arg = append (arg , "--pristine-tar" )
0 commit comments