File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -496,6 +496,36 @@ struct GitInputScheme : InputScheme
496496 Git interprets them as part of the file name. So get
497497 rid of them. */
498498 url.query .clear ();
499+ /* Backward compatibility hack: In old versions of Nix, if you had
500+ a flake input like
501+
502+ inputs.foo.url = "git+https://foo/bar?dir=subdir";
503+
504+ it would result in a lock file entry like
505+
506+ "original": {
507+ "dir": "subdir",
508+ "type": "git",
509+ "url": "https://foo/bar?dir=subdir"
510+ }
511+
512+ New versions of Nix remove `?dir=subdir` from the `url` field,
513+ since the subdirectory is intended for `FlakeRef`, not the
514+ fetcher (and specifically the remote server), that is, the
515+ flakeref is parsed into
516+
517+ "original": {
518+ "dir": "subdir",
519+ "type": "git",
520+ "url": "https://foo/bar"
521+ }
522+
523+ However, new versions of nix parsing old flake.lock files would pass the dir=
524+ query parameter in the "url" attribute to git, which will then complain.
525+
526+ For this reason, we filtering the `dir` query parameter from the URL
527+ before passing it to git. */
528+ url.query .erase (" dir" );
499529 repoInfo.location = url;
500530 }
501531
You can’t perform that action at this time.
0 commit comments