aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-13 20:27:48 +0000
committertv <tv@krebsco.de>2026-11-13 21:58:36 +0100
commitef581c93f391919b35b903b93af45f33d90de15d (patch)
tree13ab36537f805dcba0534c8f3e1b3f4d6b8e13b4 /tests
parente9256952f16eb33f9b7e49777ec76878489a5053 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/scenarios.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/scenarios.nix b/tests/scenarios.nix
index 14a2c91..85b481e 100644
--- a/tests/scenarios.nix
+++ b/tests/scenarios.nix
@@ -2105,6 +2105,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 = {