Skip to content

Commit

Permalink
Fix formatting following rebase onto forc anyhow PR
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchmindtree committed Mar 3, 2022
1 parent 81e9ebc commit edd39aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion forc/src/lock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{anyhow, Result};
use crate::pkg;
use anyhow::{anyhow, Result};
use petgraph::{visit::EdgeRef, Direction};
use serde::{Deserialize, Serialize};
use std::{
Expand Down
15 changes: 10 additions & 5 deletions forc/src/pkg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use anyhow::{anyhow, bail, Result};
use crate::{
lock::Lock,
utils::{
Expand All @@ -10,6 +9,7 @@ use crate::{
manifest::Manifest,
},
};
use anyhow::{anyhow, bail, Result};
use petgraph::{self, visit::EdgeRef, Directed, Direction};
use serde::{Deserialize, Serialize};
use std::{
Expand Down Expand Up @@ -160,7 +160,6 @@ impl BuildPlan {
})
}


/// Attempt to load the build plan from the `Lock`.
pub fn from_lock(proj_path: &Path, lock: &Lock) -> Result<Self> {
let graph = lock.to_graph()?;
Expand Down Expand Up @@ -510,7 +509,9 @@ where
let repo = git2::Repository::clone(&repo_url_string, &repo_dir).map_err(|e| {
anyhow!(
"failed to clone package '{}' from '{}': {}",
name, source.repo, e
name,
source.repo,
e
)
})?;

Expand All @@ -537,15 +538,19 @@ fn pin_git(name: &str, source: SourceGit) -> Result<SourceGitPinned> {
.map_err(|e| {
anyhow!(
"failed to find git ref '{}' for package '{}': {}",
source.reference, name, e
source.reference,
name,
e
)
})?;

// Follow the reference until we find the latest commit and retrieve its hash.
let commit = reference.peel_to_commit().map_err(|e| {
anyhow!(
"failed to obtain commit for ref '{}' of package '{}': {}",
source.reference, name, e
source.reference,
name,
e
)
})?;
Ok(format!("{}", commit.id()))
Expand Down

0 comments on commit edd39aa

Please sign in to comment.