History

[clone] assert on ref-prefix for ls-refs command

Even though in V1, we don't call it, let's just codify it to keep the knowledge somewhere.

Sebastian Thiel committed 6 years ago

Commit 70347a51 parent d55cd562 files · +50 −11Browse files

Showing the changes to git-protocol/src/fetch/command.rs (1 of 2 files). Show all

Unified · Split

git-protocol/src/fetch/command.rs+7−2
@@ -62,7 +62,7 @@ impl Command { · 61 unmodified lines
6262 pub(crate) fn collect_initial_features<'a>(
6363 &'a self,
6464 _version: git_transport::Protocol,
65− capabilities: &'a Capabilities,
65+ server: &'a Capabilities,
6666 ) -> impl Iterator<Item = (&str, Option<&str>)> + 'a {
6767 match Command::LsRefs {
6868 Command::Fetch => unimplemented!("collect for fetch"),
@@ -70,7 +70,7 @@ impl Command { · 1 unmodified line
7070 .all_features()
7171 .filter(move |feature| {
7272 if *feature == "symrefs" {
73− capabilities.iter().any(|c| c.name() == b"symref".as_bstr())
73+ server.iter().any(|c| c.name() == b"symref".as_bstr())
7474 } else {
7575 true
7676 }
@@ -105,6 +105,11 @@ impl Command { · 28 unmodified lines
105105 }
106106 panic!("{}: capability {} is not supported", self.as_str(), feature);
107107 }
108+ if *self == Command::LsRefs {
109+ if arguments.iter().any(|a| a.starts_with_str("ref-prefix ")) {
110+ panic!("ref-prefix is not supported in V1 ls-refs");
111+ }
112+ }
108113 }
109114 git_transport::Protocol::V2 => {
110115 if let Some(allowed) = server.iter().find_map(|c| {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t