From c3ca6d4b991ea24192ac4ddec156d0530b462c3e Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 13 Nov 2026 21:08:21 +0000 Subject: populate: keep URLs, refs, and names from being taken for options A git source's url and ref are strings, and git clone, git remote, and git fetch took ones starting with - for options, e.g. --upload-pack, which runs a command where the repository is local. They come after -- now, and so does a pass source's name for git log and pass show. git-ref-option gives a ref that git fetch would take for --upload-pack. --- tests/scenarios.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/scenarios.nix b/tests/scenarios.nix index 2fc1bd7..8093e02 100644 --- a/tests/scenarios.nix +++ b/tests/scenarios.nix @@ -2104,6 +2104,29 @@ assert !(krops.isLocalTarget (targets.remote "/")); } ]; })) + # A ref that git fetch would take for an option: --upload-pack runs a + # command where the repository is local. + (s "git-ref-option" (let + elsewhere = "/var/krops-elsewhere"; + in { + isolate = true; + prepare = '' + rm -fR ${elsewhere} + git clone -q --bare ${gitUrl} ${elsewhere}/repo.git + ''; + phases = [ + { + sources.x.git = { + url = "${elsewhere}/repo.git"; + ref = "--upload-pack=touch ${elsewhere}/ran; git-upload-pack"; + }; + expect.fail = "invalid refspec"; + check = '' + test ! -e ${elsewhere}/ran || fail "the ref ran a command" + ''; + } + ]; + })) # A file in populate's state replaced by a symlink to a file outside. (s "state-key" (let sources.x.flake-input = { -- cgit v1.3.1