Skip to content

Commit

Permalink
Remove git2 and hex dependencies (#1992)
Browse files Browse the repository at this point in the history
This removes the only use of the `git2` and `hex` dependencies by reading the test262 submodule commit id directly from the `.git` directory.

Because `git2` depends on a lot of other crates, this removes a bunch of dependencies.
  • Loading branch information
raskad committed Mar 31, 2022
1 parent c23d32b commit 76ef1a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 175 deletions.
157 changes: 0 additions & 157 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions boa_tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ regex = "1.5.5"
once_cell = "1.10.0"
colored = "2.0.0"
fxhash = "0.2.1"
git2 = "0.14.2"
hex = "0.4.3"
num-format = "0.4.0"
gc = { version = "0.4.1", features = ["derive"] }
rayon = "1.5.1"
Expand Down
21 changes: 5 additions & 16 deletions boa_tester/src/results.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use super::SuiteResult;
use git2::Repository;
use hex::ToHex;
use serde::{Deserialize, Serialize};
use std::{
env, fs,
Expand Down Expand Up @@ -175,20 +173,11 @@ pub(crate) fn write_json(

/// Gets the commit OID of the test262 submodule.
fn get_test262_commit() -> Box<str> {
let repo = Repository::open(".").expect("could not open git repository in current directory");

let submodule = repo
.submodules()
.expect("could not get the list of submodules of the repo")
.into_iter()
.find(|sub| sub.path() == Path::new("test262"))
.expect("test262 submodule not found");

submodule
.index_id()
.expect("could not get the commit OID")
.encode_hex::<String>()
.into_boxed_str()
let mut commit_id = fs::read_to_string(".git/modules/test262/HEAD")
.expect("did not find git submodule ref at '.git/modules/test262/HEAD'");
// Remove newline.
commit_id.pop();
commit_id.into_boxed_str()
}

/// Updates the GitHub pages repository by pulling latest changes before writing the new things.
Expand Down

0 comments on commit 76ef1a8

Please sign in to comment.