summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/fetchgit/nix-prefetch-git
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-02-16 15:07:46 +0100
committerMichael Weiss <dev.primeos@gmail.com>2021-02-18 11:34:34 +0100
commit2aadb9a53d839400e7a1e1abc1e5b561e6df7827 (patch)
tree657cd093c506343dc5234a815aac0603144d959b /pkgs/build-support/fetchgit/nix-prefetch-git
parent1d51f8e360dbc4d886eb1ed52baefcf22cde7db9 (diff)
nix-prefetch-git: Run git-init with --initial-branch=master
The reason for this change is simply to avoid the following messages that are unnecessary and can be confusing (and these messages will be repeated for each submodule): hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch <name> hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m <name> With this change the behaviour remains unchanged (apart from the suppressed "warning" in the console output of course) and therefore this doesn't cause any hashes to change and by default nix-prefetch-git uses the "fetchgit" branch anyway (branchName can be set to override the default): Switched to a new branch 'fetchgit' For that reason the initial branch name doesn't matter anyway and since we're not relying on / hardcoding "master" we could simply switch to "main" (which seems most common nowadays). See [0] for more details on why this wouldn't break anything. However, since the initial branch name doesn't matter and to avoid any additional risks it was "decided" to keep using "master" (s. #113313). [0]: https://github.com/NixOS/nixpkgs/pull/113313#issuecomment-780589516
Diffstat (limited to 'pkgs/build-support/fetchgit/nix-prefetch-git')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 3cb115c5e6e6..a2dad2f698c3 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -105,7 +105,7 @@ fi
init_remote(){
local url=$1
- clean_git init
+ clean_git init --initial-branch=master
clean_git remote add origin "$url"
( [ -n "$http_proxy" ] && clean_git config http.proxy "$http_proxy" ) || true
}