1From 3bbc396c4ddc8a5e26f7776155bb366c8d47c440 Mon Sep 17 00:00:00 2001
2From: Bob van der Linden <bobvanderlinden@gmail.com>
3Date: Thu, 9 Feb 2023 16:55:00 +0100
4Subject: [PATCH 2/2] remove dependency on git
5
6---
7 librubyfmt/build.rs | 35 +++--------------------------------
8 1 file changed, 3 insertions(+), 32 deletions(-)
9
10diff --git a/librubyfmt/build.rs b/librubyfmt/build.rs
11index ef94c09..4668785 100644
12--- a/librubyfmt/build.rs
13+++ b/librubyfmt/build.rs
14@@ -26,27 +26,9 @@ fn main() -> Output {
15 let path = std::env::current_dir()?;
16 let ruby_checkout_path = path.join("ruby_checkout");
17
18- let old_checkout_sha = if ruby_checkout_path.join(ripper).exists() {
19- Some(get_ruby_checkout_sha())
20- } else {
21- None
22- };
23-
24- let _ = Command::new("git")
25- .args(&["submodule", "update", "--init"])
26- .status();
27-
28- let new_checkout_sha = get_ruby_checkout_sha();
29-
30- // Only rerun this build if the ruby_checkout has changed
31- match old_checkout_sha {
32- Some(old_sha) if old_sha == new_checkout_sha => {}
33- _ => {
34- make_configure(&ruby_checkout_path)?;
35- run_configure(&ruby_checkout_path)?;
36- build_ruby(&ruby_checkout_path)?;
37- }
38- }
39+ make_configure(&ruby_checkout_path)?;
40+ run_configure(&ruby_checkout_path)?;
41+ build_ruby(&ruby_checkout_path)?;
42
43 cc::Build::new()
44 .file("src/rubyfmt.c")
45@@ -152,14 +134,3 @@ fn check_process_success(command: &str, code: ExitStatus) -> Output {
46 }
47 }
48
49-fn get_ruby_checkout_sha() -> String {
50- String::from_utf8(
51- Command::new("git")
52- .args(&["rev-parse", "HEAD"])
53- .current_dir("./ruby_checkout")
54- .output()
55- .expect("git rev-parse shouldn't fail")
56- .stdout,
57- )
58- .expect("output should be valid utf8")
59-}
60--
612.39.1
62