Skip to content

Commit acfef1a

Browse files
committed
Simplify git init command as Git 2.28+ is now widely supported
Debian 11 "Bullseye" shipped with Git 2.30, so it is unlikely anybody doing Debian packaging uses a Git version older than that anymore, at least not in combination with this latest dh-make-golang version. Thus it is possible to activate the shorthand git init form as planned in 2021 since 729d8db.
1 parent 9ddc3dc commit acfef1a

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

make.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,9 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
435435
return "", fmt.Errorf("mkdir: %w", err)
436436
}
437437

438-
// "git init -b" is the one-liner we need here, however it was added in Git 2.28.
439-
// For now we prefer to keep compatibility with older Git, so we do it in two
440-
// rounds, "git init" then "git checkout".
441-
//if err := runGitCommandIn(dir, "init", "-b", debianBranch); err != nil {
442-
// return dir, err
443-
//}
444-
if err := runGitCommandIn(dir, "init"); err != nil {
438+
if err := runGitCommandIn(dir, "init", "-b", debianBranch); err != nil {
445439
return dir, fmt.Errorf("git init: %w", err)
446440
}
447-
if err := runGitCommandIn(dir, "checkout", "-q", "-b", debianBranch); err != nil {
448-
return dir, fmt.Errorf("git checkout: %w", err)
449-
}
450441

451442
// Set repository options
452443

0 commit comments

Comments
 (0)