Skip to content

Commit 3f185cd

Browse files
committed
Add "branch" information for builtins.fetchGit
This is the counterpart of nix-tools proposed change: input-output-hk/nix-tools#99
1 parent 80f3a84 commit 3f185cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/stack-cache-generator.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ let
5858
cp -r "${maybeCleanedSource}/." $TMP
5959
chmod -R +w $TMP
6060
substituteInPlace ${stackYaml} --replace "# nix-sha256:" "nix-sha256:"
61+
substituteInPlace ${stackYaml} --replace "# nix-branch:" "nix-branch:"
6162
${pkgs.lib.optionalString (fetchedResolver != null) ''
6263
substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
6364
''}
@@ -90,9 +91,9 @@ concatMap (dep:
9091
inherit (dep) url rev;
9192
inherit sha256;
9293
}
93-
else builtins.fetchGit {
94+
else builtins.fetchGit ({
9495
inherit (dep) url rev;
95-
};
96+
} // pkgs.lib.optionalAttrs (dep ? branch && dep.branch != null) { ref = dep.branch; });
9697
in map (subdir: {
9798
name = cabalName "${pkgsrc}/${subdir}";
9899
inherit (dep) url rev;

0 commit comments

Comments
 (0)