Skip to content

Commit 729d8db

Browse files
elboulangeroanthonyfok
authored andcommitted
Keep compatibility with Git below 2.28
Thanks to Alois Micard for pointing that out
1 parent e775617 commit 729d8db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

make.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,16 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
395395
return "", err
396396
}
397397

398-
if err := runGitCommandIn(dir, "init", "-b", debianBranch); err != nil {
398+
// "git init -b" is the one-liner we need here, however it was added in Git 2.28.
399+
// For now we prefer to keep compatibility with older Git, so we do it in two
400+
// rounds, "git init" then "git checkout".
401+
//if err := runGitCommandIn(dir, "init", "-b", debianBranch); err != nil {
402+
// return dir, err
403+
//}
404+
if err := runGitCommandIn(dir, "init"); err != nil {
405+
return dir, err
406+
}
407+
if err := runGitCommandIn(dir, "checkout", "-q", "-b", debianBranch); err != nil {
399408
return dir, err
400409
}
401410

0 commit comments

Comments
 (0)