Skip to content

Commit 288beae

Browse files
committed
cleanup
1 parent ec2dcf4 commit 288beae

File tree

8 files changed

+37
-22
lines changed

8 files changed

+37
-22
lines changed

lib/bencher_adapter/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ edition.workspace = true
66
license-file.workspace = true
77
publish = false
88

9+
[features]
10+
full = ["bencher_json/full"]
11+
lite = ["bencher_json/lite"]
12+
913
[dependencies]
1014
# Workspace
11-
bencher_json = { workspace = true, features = ["full"] }
15+
bencher_json.workspace = true
1216
literally.workspace = true
1317
ordered-float.workspace = true
1418
serde.workspace = true

lib/bencher_valid/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ plus = ["chrono/clock"]
1717
schema = ["dep:schemars", "ordered-float/schemars"]
1818
wasm = [
1919
"dep:console_error_panic_hook",
20-
"dep:wasm-bindgen",
20+
"dep:regex-lite",
2121
"dep:serde_json",
22+
"dep:wasm-bindgen",
2223
"chrono/wasmbind",
23-
"lite",
2424
]
2525

2626
[dependencies]

lib/bencher_valid/src/fingerprint/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use derive_more::Display;
55
use schemars::JsonSchema;
66
use serde::{Deserialize, Serialize};
77
use uuid::Uuid;
8-
#[cfg(feature = "wasm")]
9-
use wasm_bindgen::prelude::*;
108

119
use crate::ValidError;
1210

lib/bencher_valid/src/fingerprint/target_os/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl crate::Fingerprint {
99
let uuid = hstring.to_string();
1010
println!("{uuid}");
1111
println!("{}", uuid.trim());
12-
Uuid::parse_str(&uuid).ok()
12+
Uuid::parse_str(&hstring.to_string().trim()).ok()
1313
})
1414
.map(Self)
1515
}

services/api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ sentry = ["dep:sentry"]
2222
[dependencies]
2323
# Workspace
2424
async-trait.workspace = true
25-
bencher_adapter.workspace = true
25+
bencher_adapter = { workspace = true, features = ["full"] }
2626
bencher_billing = { workspace = true, optional = true }
2727
bencher_bing_index = { workspace = true, optional = true }
2828
bencher_boundary.workspace = true

services/cli/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ publish = false
1010
default = ["plus"]
1111
plus = ["bencher_client/plus", "bencher_comment/plus", "bencher_json/plus"]
1212

13-
[build-dependencies]
14-
bencher_json = { workspace = true, features = ["lite"] }
13+
# [build-dependencies]
14+
# bencher_json = { workspace = true, features = ["lite"] }
1515

1616
[dependencies]
1717
# Workspace
18-
bencher_adapter.workspace = true
18+
bencher_adapter = { workspace = true, features = ["lite"] }
1919
bencher_client.workspace = true
2020
bencher_comment.workspace = true
2121
bencher_json = { workspace = true, features = ["lite", "table"] }

services/cli/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
// This is here to test that the fingerprinting is working correctly on all platforms.
3-
#[allow(clippy::expect_used)]
4-
let _ = bencher_json::Fingerprint::new().expect("Failed to create fingerprint");
3+
// #[allow(clippy::expect_used)]
4+
// let _ = bencher_json::Fingerprint::new().expect("Failed to create fingerprint");
55
}

services/cli/src/bencher/sub/project/run/project.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use bencher_fingerprint::Fingerprint;
1+
use bencher_json::{Fingerprint, GitHash};
22
use gix::Repository;
33

4-
use crate::bencher::sub::project::run::branch::find_repo;
4+
use super::branch::find_repo;
55

66
const ROOT: &str = "root";
77

@@ -13,8 +13,12 @@ pub fn local_project() {
1313
}
1414

1515
if let Some(repo) = repo {
16+
if let Some(branch) = current_branch_name(&repo) {
17+
println!("{branch:?}");
18+
}
19+
1620
if let Some(root_commit) = find_default_branch_and_root_commit(&repo) {
17-
println!("Root commit hash: {root_commit}");
21+
println!("Root commit hash: {root_commit:?}");
1822
}
1923
}
2024

@@ -33,12 +37,21 @@ fn repo_name(repo: Option<&Repository>) -> Option<String> {
3337
file_name.to_str().map(ToOwned::to_owned)
3438
}
3539

36-
fn find_default_branch_and_root_commit(repo: &Repository) -> Option<String> {
37-
let head_id = repo.head_id().ok()?;
38-
39-
let mut _rev_walk = repo.rev_walk([head_id]);
40-
41-
// let root_commit = rev_walk.all().into_iter().last()?.id().to_string();
40+
fn current_branch_name(repo: &Repository) -> Option<(String, String)> {
41+
repo.head().ok()?.referent_name().map(|name| {
42+
(
43+
String::from_utf8_lossy(name.as_bstr()).to_string(),
44+
String::from_utf8_lossy(name.shorten()).to_string(),
45+
)
46+
})
47+
}
4248

43-
None
49+
fn find_default_branch_and_root_commit(repo: &Repository) -> Option<GitHash> {
50+
let head_id = repo.head_id().ok()?;
51+
let rev_walk = repo.rev_walk([head_id]).all().ok()?;
52+
if let Some(Ok(commit)) = rev_walk.last() {
53+
Some(commit.id().object().ok()?.id.into())
54+
} else {
55+
None
56+
}
4457
}

0 commit comments

Comments
 (0)