From c955b30d4cde9350ef300876621029ff450a7750 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Tue, 12 Jan 2021 18:39:46 +0100 Subject: [PATCH] dune-release: fix tests for newer git versions Newer git versions show a hint when calling `git init` to set the default initial branch to something like 'main'. This obviously is printed to stderr and thus not hidden by `> /dev/null`. We fix the ensuing test failure by setting a branch in the invocation. --- pkgs/development/tools/ocaml/dune-release/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/ocaml/dune-release/default.nix b/pkgs/development/tools/ocaml/dune-release/default.nix index c267b2757a4..60a9bfba58f 100644 --- a/pkgs/development/tools/ocaml/dune-release/default.nix +++ b/pkgs/development/tools/ocaml/dune-release/default.nix @@ -32,9 +32,14 @@ in buildDunePackage rec { # to have a fixed path to the binary in nix store sed -i '/must_exist (Cmd\.v "curl"/d' lib/github.ml - # set bogus user info in git so git commit doesn't fail - sed -i '/git init/ a \ $ git config user.name test; git config user.email "pseudo@pseudo.invalid"' \ - tests/bin/{delegate_info,errors,tag,no_doc,x-commit-hash}/run.t + # fix problems with git invocations in tests + for f in tests/bin/{delegate_info,errors,tag,no_doc,x-commit-hash}/run.t; do + # set bogus user info in git so git commit doesn't fail + sed -i '/git init/ a \ $ git config user.name test; git config user.email "pseudo@pseudo.invalid"' "$f" + # surpress hint to set default branch name + substituteInPlace "$f" --replace "git init" "git init -b main" + done + # ignore weird yes error message sed -i 's/yes |/yes 2>\/dev\/null |/' tests/bin/no_doc/run.t '';