Last active
October 1, 2017 22:04
-
-
Save singpolyma/3429712f64b998f5b4fc37e2f3f2816d to your computer and use it in GitHub Desktop.
git-ipfs
This file contains hidden or 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
#!/bin/sh | |
set -e | |
TMP="$(mktemp -d)" | |
git clone -q --bare . "$TMP" | |
cd "$TMP" | |
git update-server-info | |
if [ objects/pack/*.pack != 'objects/pack/*.pack' ]; then | |
cat objects/pack/*.pack | git unpack-objects | |
rm -f objects/pack/* | |
fi | |
HASH="$(ipfs add -Qr .)" | |
rm -rf "$TMP" | |
if [ -n "$1" ]; then | |
ipfs name publish --key=$1 "/ipfs/$HASH" | |
else | |
echo "$HASH" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment