From 305ddf86e2a18440086c1440a0f17ffe5bf19255 Mon Sep 17 00:00:00 2001
From: cloudhead <cloudhead@radicle.xyz>
Date: Wed, 27 Mar 2024 10:40:24 +0100
Subject: [PATCH] Release test

---
 .github/workflows/release.yml |  4 ++--
 build.rs                      | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 94a24dff1..05a5dfe89 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -24,7 +24,7 @@ jobs:
       - name: Checkout source code
         uses: actions/checkout@v4
       - name: Get tags
-        run: git fetch --tags origin
+        run: git fetch --prune --unshallow --tags origin
       - name: Configure build cache
         uses: actions/cache@v4
         with:
@@ -62,7 +62,7 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - name: Get tags
-        run: git fetch --tags origin
+        run: git fetch --prune --unshallow --tags origin
       - name: Configure build cache
         uses: actions/cache@v4
         with:
diff --git a/build.rs b/build.rs
index 782c068f2..ec5dd3e24 100644
--- a/build.rs
+++ b/build.rs
@@ -38,6 +38,20 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
         .filter_map(|s| s.strip_prefix('v'))
         .collect::<Vec<_>>();
 
+    git(&["status"]);
+    git(&["rev-parse", "HEAD"]);
+    git(&["tag", "--list"]);
+    git(&["show", "v0.9.0"]);
+    git(&["show", "-s", "v0.9.0"]);
+    git(&["log", "v0.9.0..HEAD", "--oneline"]);
+    git(&["describe"]);
+    git(&["describe", "HEAD"]);
+    git(&["describe", "master"]);
+    git(&["describe", "--abbrev=0"]);
+    git(&["describe", "--abbrev=0", "--candidates=1"]);
+    git(&["describe", "--abbrev=0", "--candidates=1", "--match=v*"]);
+    git(&["ls-remote", "origin"]);
+
     if tags.len() > 1 {
         return Err("More than one version tag found for commit {hash}: {tags:?}".into());
     }
@@ -90,5 +104,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
     println!("cargo::rustc-env=GIT_COMMIT_TIME={commit_time}");
     println!("cargo::rustc-env=GIT_HEAD={hash}");
 
-    Ok(())
+    return Err("aborted".into());
+
+    // Ok(())
+}
+
+fn git(args: &[&str]) {
+    let out = Command::new("git").args(args).output().unwrap();
+
+    println!("cargo::warning=command: git {:?}", args);
+
+    for line in String::from_utf8_lossy(&out.stdout).lines() {
+        println!("cargo::warning=stdout: {}", line);
+    }
+    for line in String::from_utf8_lossy(&out.stderr).lines() {
+        println!("cargo::warning=stderr: {}", line);
+    }
+    println!("cargo::warning=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
 }