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
62 pub(crate) fn collect_initial_features<'a>(62 pub(crate) fn collect_initial_features<'a>(
63 &'a self,63 &'a self,
64 _version: git_transport::Protocol,64 _version: git_transport::Protocol,
65 capabilities: &'a Capabilities,65 server: &'a Capabilities,
66 ) -> impl Iterator<Item = (&str, Option<&str>)> + 'a {66 ) -> impl Iterator<Item = (&str, Option<&str>)> + 'a {
67 match Command::LsRefs {67 match Command::LsRefs {
68 Command::Fetch => unimplemented!("collect for fetch"),68 Command::Fetch => unimplemented!("collect for fetch"),
@@ -70,7 +70,7 @@ impl Command { · 1 unmodified line
70 .all_features()70 .all_features()
71 .filter(move |feature| {71 .filter(move |feature| {
72 if *feature == "symrefs" {72 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())
74 } else {74 } else {
75 true75 true
76 }76 }
@@ -105,6 +105,11 @@ impl Command { · 28 unmodified lines
105 }105 }
106 panic!("{}: capability {} is not supported", self.as_str(), feature);106 panic!("{}: capability {} is not supported", self.as_str(), feature);
107 }107 }
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 }
108 }113 }
109 git_transport::Protocol::V2 => {114 git_transport::Protocol::V2 => {
110 if let Some(allowed) = server.iter().find_map(|c| {115 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