@@ -418,6 +418,14 @@ func runGitCommandIn(dir string, arg ...string) error {
418
418
func createGitRepository (debsrc , gopkg , orig string , u * upstream ,
419
419
includeUpstreamHistory bool , allowUnknownHoster bool , debianBranch string ,
420
420
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
+
421
429
wd , err := os .Getwd ()
422
430
if err != nil {
423
431
return "" , fmt .Errorf ("get cwd: %w" , err )
@@ -463,7 +471,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
463
471
464
472
// Preconfigure branches
465
473
466
- branches := []string {debianBranch , "upstream/latest" }
474
+ branches := []string {debianBranch , upstreamImportBranch }
475
+
467
476
if pristineTar {
468
477
branches = append (branches , "pristine-tar" )
469
478
}
@@ -477,13 +486,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
477
486
}
478
487
479
488
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"
487
491
log .Printf ("Adding remote %q with URL %q\n " , u .remote , u .rr .Repo )
488
492
if err := runGitCommandIn (dir , "remote" , "add" , u .remote , u .rr .Repo ); err != nil {
489
493
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,
495
499
}
496
500
497
501
// Import upstream orig tarball
502
+ // (and release git tag if includeUpstreamHistory)
498
503
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 ,
502
509
}
503
510
if pristineTar {
504
511
arg = append (arg , "--pristine-tar" )
0 commit comments