From 16f1d64012b467727e5036ae611aa5477e3a4e3c Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 27 Oct 2020 11:34:06 +0000 Subject: [PATCH] BIN: Adds git dumper from here: https://github.com/internetwache/GitTools/blob/master/Dumper/gitdumper.sh --- bin/.bin/git/git-dumper | 168 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100755 bin/.bin/git/git-dumper diff --git a/bin/.bin/git/git-dumper b/bin/.bin/git/git-dumper new file mode 100755 index 00000000..f3ab2c22 --- /dev/null +++ b/bin/.bin/git/git-dumper @@ -0,0 +1,168 @@ +#!/bin/bash +#$1 : URL to download .git from (http://target.com/.git/) +#$2 : Folder where the .git-directory will be created + +function init_header() { + cat < /dev/null) + if [ $? -ne 0 ]; then + #Delete invalid file + cd "$cwd" + rm "$target" + return + fi + + #Parse output of git cat-file -p $hash. Use strings for blobs + if [[ "$type" != "blob" ]]; then + hashes+=($(git cat-file -p "$hash" | grep -oE "([a-f0-9]{40})")) + else + hashes+=($(git cat-file -p "$hash" | strings -a | grep -oE "([a-f0-9]{40})")) + fi + + cd "$cwd" + fi + + #Parse file for other objects + hashes+=($(cat "$target" | strings -a | grep -oE "([a-f0-9]{40})")) + for hash in ${hashes[*]} + do + QUEUE+=("objects/${hash:0:2}/${hash:2}") + done + + #Parse file for packs + packs+=($(cat "$target" | strings -a | grep -oE "(pack\-[a-f0-9]{40})")) + for pack in ${packs[*]} + do + QUEUE+=("objects/pack/$pack.pack") + QUEUE+=("objects/pack/$pack.idx") + done +} + + +start_download