Skip to content

Makefile: Fix libgit2/git builds with old git versions

Patrick Steinhardt requested to merge pks-makefile-git-init-default-branch into master

In order to silence git's warning that the default branch created by git-init(1) may change in the future, we've added the --initial-branch to the command in bcd7a5ee (Makefile: set --initial-branch=master on "git init", 2021-02-25). Given that this flag has been introduced relatively recent with git v2.28.0, older versions of git cannot build neither the "git" nor the "libgit2" targets now.

Fix the issue by instead passing the initial branch via a config entry. These simply get ignored by older versions where the default branch is "master" anyway, and newer versions correctly use it and thus do not print the warning. Furthermore, it also stops the "warning: re-init: ignored --initial-branch=master" warning which gets printed when we reinitialize the repo.

Merge request reports

Loading