This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
data/git-platinum: use tarball file to keep track of git-platinum
Instead of using a git submodule to keep track of git-platinum, we use a cloned version of git-platinum that is compressed into a tarball file. This gets uncompressed via the `build.rs` file so that it can used by the tests. A helper script for cloning and compressing git-platinum is provided to get new updates, while also adding custom branches for our tests. Signed-off-by: Tomasz Kurcz <[email protected]> Signed-off-by: Fintan Halpenny <[email protected]>
- Loading branch information
Showing
14 changed files
with
110 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
[submodule "data/git-platinum"] | ||
path = data/git-platinum | ||
url = https://github.com/radicle-dev/git-platinum.git | ||
branch = master | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Updating [git-platinum](https://github.com/radicle-dev/git-platinum) Just `cd` | ||
into the repo root, then run `scripts/update-git-platinum.sh`. This will update | ||
the tarball and it's necessary to commit the change. We provide a template below | ||
so that we can easily identify changes to `git-platinum`. Please fill in the | ||
details that follow a comment (`#`): | ||
|
||
|
||
data/git-platinum: # short reason for updating | ||
|
||
# provide a longer reason for making changes to git-platinum | ||
# as well as what has changed. |
Submodule git-platinum
deleted from
a0dd91
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Verify that the script is run from project root. | ||
BASE=$(basename $(pwd)) | ||
|
||
if [ "${BASE}" != "radicle-surf" ] | ||
then | ||
echo "ERROR: this script should be run from the root of radicle-surf" | ||
exit 1 | ||
fi | ||
|
||
TARBALL_PATH=data/git-platinum.tgz | ||
WORKDIR=.workdir | ||
|
||
# Create the workdir if needed. | ||
mkdir -p $WORKDIR | ||
|
||
# This is here in case the last script run failed and it never cleaned up. | ||
rm -rf $WORKDIR/git-platinum | ||
|
||
# Clone an up-to-date version of git-platinum. | ||
git clone https://github.com/radicle-dev/git-platinum.git $WORKDIR/git-platinum | ||
git -C $WORKDIR/git-platinum/ checkout dev | ||
|
||
# Add the necessary refs. | ||
input="./data/mock-branches.txt" | ||
while IFS= read -r line | ||
do | ||
IFS=, read -a pair <<< $line | ||
echo "Creating branch ${pair[0]}" | ||
git -C $WORKDIR/git-platinum/ update-ref ${pair[0]} ${pair[1]} | ||
done < "$input" | ||
|
||
# Update the archive. | ||
tar -czf $WORKDIR/git-platinum.tgz $WORKDIR/git-platinum | ||
mv $WORKDIR/git-platinum.tgz $TARBALL_PATH | ||
|
||
# Clean up. | ||
rm -rf $WORKDIR/git-platinum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// This file is part of radicle-surf | ||
// <https://github.com/radicle-dev/radicle-surf> | ||
// | ||
// Copyright (C) 2019-2020 The Radicle Team <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License version 3 or | ||
// later as published by the Free Software Foundation. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use std::{fs::File, path::Path}; | ||
|
||
use flate2::read::GzDecoder; | ||
use tar::Archive; | ||
|
||
fn main() { | ||
let git_platinum_tarball = "../data/git-platinum.tgz"; | ||
let target = "../data/"; | ||
|
||
unpack(git_platinum_tarball, target).expect("Failed to unpack git-platinum"); | ||
|
||
println!("cargo:rerun-if-changed={}", git_platinum_tarball); | ||
} | ||
|
||
fn unpack(archive_path: impl AsRef<Path>, target: impl AsRef<Path>) -> Result<(), std::io::Error> { | ||
let tar_gz = File::open(archive_path.as_ref())?; | ||
let tar = GzDecoder::new(tar_gz); | ||
let mut archive = Archive::new(tar); | ||
archive.unpack(target)?; | ||
|
||
Ok(()) | ||
} |