Skip to content

Commit a2fab1e

Browse files
committed
fix: use branch
1 parent fce999b commit a2fab1e

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

coffee_core/src/coffee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl PluginManager for CoffeeManager {
247247
plugin: &str,
248248
verbose: bool,
249249
try_dynamic: bool,
250-
_branch: Option<String>,
250+
branch: Option<String>,
251251
) -> Result<(), CoffeeError> {
252252
log::debug!("installing plugin: {plugin}");
253253
// keep track if the plugin is successfully installed
@@ -356,7 +356,7 @@ impl PluginManager for CoffeeManager {
356356
let status = repository.upgrade(&self.config.plugins).await?;
357357
for plugins in status.plugins_effected.iter() {
358358
self.remove(plugins).await?;
359-
self.install(plugins, verbose, false, None).await?;
359+
self.install(plugins, verbose, false, branch).await?;
360360
}
361361
self.flush().await?;
362362
Ok(status)

coffee_github/src/repository.rs

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ impl Repository for Github {
311311
}
312312

313313
async fn switch_branch(&mut self, branch_name: &str) -> Result<(), CoffeeError> {
314+
// FIXME: implement the From git2 Error for `CoffeError`
314315
let repo = git2::Repository::open(&self.url.path_string)
315316
.map_err(|err| error!("{}", err.message()))?;
316317
let mut remote = repo

coffee_httpd/src/httpd/server.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ async fn coffee_install(
9191
let try_dynamic = body.try_dynamic;
9292

9393
let mut coffee = data.coffee.lock().await;
94-
let result = coffee.install(plugin, false, try_dynamic, None).await;
94+
let branch = body.branch;
95+
let result = coffee.install(plugin, false, try_dynamic, branch).await;
9596

9697
handle_httpd_response!(result, "Plugin '{plugin}' installed successfully")
9798
}

coffee_plugin/src/plugin/plugin_mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl RPCCommand<State> for CoffeeInstall {
9898
let rt = Runtime::new().unwrap();
9999

100100
let request: InstallReq = serde_json::from_value(request)?;
101-
rt.block_on(coffee.install(&request.name, false, true, None))
101+
rt.block_on(coffee.install(&request.name, false, true, Some(request.branch)))
102102
.map_err(from)?;
103103
Ok(json!({}))
104104
}

0 commit comments

Comments
 (0)