@@ -419,6 +419,14 @@ func runGitCommandIn(dir string, arg ...string) error {
419419func createGitRepository (debsrc , gopkg , orig string , u * upstream ,
420420 includeUpstreamHistory bool , allowUnknownHoster bool , debianBranch string ,
421421 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+
422430 wd , err := os .Getwd ()
423431 if err != nil {
424432 return "" , fmt .Errorf ("get cwd: %w" , err )
@@ -464,7 +472,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
464472
465473 // Preconfigure branches
466474
467- branches := []string {debianBranch , "upstream/latest" }
475+ branches := []string {debianBranch , upstreamImportBranch }
476+
468477 if pristineTar {
469478 branches = append (branches , "pristine-tar" )
470479 }
@@ -478,13 +487,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
478487 }
479488
480489 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"
488492 log .Printf ("Adding remote %q with URL %q\n " , u .remote , u .rr .Repo )
489493 if err := runGitCommandIn (dir , "remote" , "add" , u .remote , u .rr .Repo ); err != nil {
490494 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,
496500 }
497501
498502 // Import upstream orig tarball
503+ // (and release git tag if includeUpstreamHistory)
499504
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 ,
503510 }
504511 if pristineTar {
505512 arg = append (arg , "--pristine-tar" )
0 commit comments