summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ls-refs.c2
-rwxr-xr-xt/t5701-git-serve.sh13
2 files changed, 15 insertions, 0 deletions
diff --git a/ls-refs.c b/ls-refs.c
index 07429f3a1c..883c0c58b2 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -170,6 +170,8 @@ int ls_refs(struct repository *r, struct packet_reader *request)
}
else if (!strcmp("unborn", arg))
data.unborn = allow_unborn;
+ else
+ die(_("unexpected line: '%s'"), arg);
}
if (request->status != PACKET_READ_FLUSH)
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 3928424e1b..aa1827d841 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -147,6 +147,19 @@ test_expect_success 'basics of ls-refs' '
test_cmp expect actual
'
+test_expect_success 'ls-refs complains about unknown options' '
+ test-tool pkt-line pack >in <<-EOF &&
+ command=ls-refs
+ object-format=$(test_oid algo)
+ 0001
+ no-such-arg
+ 0000
+ EOF
+
+ test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
+ grep unexpected.line.*no-such-arg err
+'
+
test_expect_success 'basic ref-prefixes' '
test-tool pkt-line pack >in <<-EOF &&
command=ls-refs