mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 13:11:00 +01:00
libfetchers/git: Add support for '.' in gitsubmodules
Period '.' is a special branch name in the gitsubmodule file which represents the branch of the parent repository [1]. We add support for this by registering the ref of the InputAccessor to be that of the parent input if '.' is encountered. Fixes #13215 [1]: man gitmodules
This commit is contained in:
parent
f64000e3f4
commit
b21304fe4c
4 changed files with 217 additions and 13 deletions
|
|
@ -739,8 +739,16 @@ struct GitInputScheme : InputScheme
|
|||
fetchers::Attrs attrs;
|
||||
attrs.insert_or_assign("type", "git");
|
||||
attrs.insert_or_assign("url", resolved);
|
||||
if (submodule.branch != "")
|
||||
attrs.insert_or_assign("ref", submodule.branch);
|
||||
if (submodule.branch != "") {
|
||||
// A special value of . is used to indicate that the name of the branch in the submodule
|
||||
// should be the same name as the current branch in the current repository.
|
||||
// https://git-scm.com/docs/gitmodules
|
||||
if (submodule.branch == ".") {
|
||||
attrs.insert_or_assign("ref", ref);
|
||||
} else {
|
||||
attrs.insert_or_assign("ref", submodule.branch);
|
||||
}
|
||||
}
|
||||
attrs.insert_or_assign("rev", submoduleRev.gitRev());
|
||||
attrs.insert_or_assign("exportIgnore", Explicit<bool>{exportIgnore});
|
||||
attrs.insert_or_assign("submodules", Explicit<bool>{true});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue