commitIdFromGitRepo: fix stackoverflow if many branches are used.
commitIdFromGitRepo: fix stackoverflow if many branches are used.

If many branches are created than builtins.match stack overflows because
of a bug in libstdc++: see https://github.com/NixOS/nix/issues/2147

NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs