GitHub

@@ -106,7 +106,8 @@ pub struct RawPlugin {

106106

/// An inline script.

107107

pub inline: Option<String>,

108108

/// What protocol to use when cloning a repository.

109-

pub protocol: Option<GitProtocol>,

109+

#[serde(alias = "protocol")]

110+

pub proto: Option<GitProtocol>,

110111

/// The Git reference to checkout.

111112

#[serde(flatten)]

112113

pub reference: Option<GitReference>,

@@ -523,7 +524,7 @@ impl RawPlugin {

523524

remote,

524525

local,

525526

inline,

526-

protocol,

527+

proto,

527528

reference,

528529

directory,

529530

uses,

@@ -542,7 +543,7 @@ impl RawPlugin {

542543

(None, Some(repository), None, None, None, None) => {

543544

let url_str = format!(

544545

"{}{}/{}",

545-

protocol.unwrap_or(GitProtocol::Https).prefix(),

546+

proto.unwrap_or(GitProtocol::Https).prefix(),

546547

GIST_HOST,

547548

repository.identifier

548549

);

@@ -554,7 +555,7 @@ impl RawPlugin {

554555

(None, None, Some(repository), None, None, None) => {

555556

let url_str = format!(

556557

"{}{}/{}",

557-

protocol.unwrap_or(GitProtocol::Https).prefix(),

558+

proto.unwrap_or(GitProtocol::Https).prefix(),

558559

GITHUB_HOST,

559560

repository

560561

);

@@ -587,8 +588,8 @@ impl RawPlugin {

587588

"the `branch`, `tag`, and `rev` fields are not supported by this plugin \

588589

type"

589590

);

590-

} else if protocol.is_some() && !is_gist_or_github {

591-

bail!("the `protocol` field is not supported by this plugin type");

591+

} else if proto.is_some() && !is_gist_or_github {

592+

bail!("the `proto` field is not supported by this plugin type");

592593

}

593594594595

validate_template_names(&apply, templates)?;

@@ -603,7 +604,7 @@ impl RawPlugin {

603604

}

604605

TempSource::Inline(raw) => {

605606

let unsupported = [

606-

("`protocol` field is", protocol.is_some()),

607+

("`proto` field is", proto.is_some()),

607608

("`branch`, `tag`, and `rev` fields are", is_reference_some),

608609

("`directory` field is", directory.is_some()),

609610

("`use` field is", uses.is_some()),

@@ -944,7 +945,7 @@ mod tests {

944945

.parse()

945946

.unwrap(),

946947

),

947-

protocol: Some(GitProtocol::Git),

948+

proto: Some(GitProtocol::Git),

948949

..Default::default()

949950

};

950951

assert_eq!(

@@ -997,7 +998,7 @@ mod tests {

997998

.parse()

998999

.unwrap(),

9991000

),

1000-

protocol: Some(GitProtocol::Ssh),

1001+

proto: Some(GitProtocol::Ssh),

10011002

..Default::default()

10021003

};

10031004

assert_eq!(

@@ -1024,7 +1025,7 @@ mod tests {

10241025

owner: "rossmacarthur".to_string(),

10251026

name: "sheldon-test".to_string(),

10261027

}),

1027-

protocol: Some(GitProtocol::Git),

1028+

proto: Some(GitProtocol::Git),

10281029

..Default::default()

10291030

};

10301031

assert_eq!(

@@ -1077,7 +1078,7 @@ mod tests {

10771078

owner: "rossmacarthur".to_string(),

10781079

name: "sheldon-test".to_string(),

10791080

}),

1080-

protocol: Some(GitProtocol::Ssh),

1081+

proto: Some(GitProtocol::Ssh),

10811082

..Default::default()

10821083

};

10831084

assert_eq!(

@@ -1139,15 +1140,15 @@ mod tests {

11391140

)

11401141

.unwrap(),

11411142

),

1142-

protocol: Some(GitProtocol::Https),

1143+

proto: Some(GitProtocol::Https),

11431144

..Default::default()

11441145

};

11451146

let error = raw_plugin

11461147

.normalize("test".to_string(), &IndexMap::new())

11471148

.unwrap_err();

11481149

assert_eq!(

11491150

error.to_string(),

1150-

"the `protocol` field is not supported by this plugin type"

1151+

"the `proto` field is not supported by this plugin type"

11511152

);

11521153

}

11531154

Read the original on github.com ↗