From 71e3ca00e35e26fc7738ed955bb7178fac4c919d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jul 2017 18:36:07 -0400 Subject: Use pools in git --- bin/gitthing | 71 ------------------------------------------------------------ 1 file changed, 71 deletions(-) delete mode 100755 bin/gitthing (limited to 'bin/gitthing') diff --git a/bin/gitthing b/bin/gitthing deleted file mode 100755 index ff7b5ac..0000000 --- a/bin/gitthing +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -empty() { - [[ $(stat -c %s "$1") -eq 0 ]] -} - -url2murl() { - local x - x=$1 - x=${x//'^'/'^5E'} - x=${x//':'/'^3A'} - x=${x//'%'/'^25'} - printf '%s' "$x" -} - -murl2url() { - local x - x=$1 - x=${x//'^25'/'%'} - x=${x//'^3A'/':'} - x=${x//'^5E'/'^'} - printf '%s' "$x" -} - -main() { - set -euE -o pipefail - top=$PWD - - mkdir -p "$1" - cd "$1" - git init - echo 'ref: refs/heads/PROGRAMS/CVTUTF' > .git/HEAD - git commit --allow-empty -m 'initial commit' - - while read -r time url; do - suffix="${url##*/Public/}" - dirpart="${suffix%/*}" - filepart="${suffix##*/}" - - branch=$dirpart - - git checkout PROGRAMS/CVTUTF - git checkout -b "$branch" || true - git checkout "$branch" - - if [[ -n "$filepart" ]]; then - file="$top/dat/content-file/$time/$(url2murl "$url")" - cp "$file" . - else - dir="$top/dat/content-dir/$time/$(url2murl "$url")" - comm -23 \ - <(git ls-files) \ - <(< "$dir/metadata.txt" awk '{print $1}') \ - | xargs -r0 rm -f -- - if ! empty "$dir/readme.txt"; then - cp "$dir/readme.txt" . - fi - cp "$dir/metadata.txt" .metadata.txt - fi - - if [[ -n "$(git status -s .)" ]]; then - gitdate="$(sed -r 's/(....)(..)(..)(..)(..)(..)/\1-\2-\3T\4:\5:\6/' <<<"$time")" - git add . - export GIT_AUTHOR_DATE=$gitdate - export GIT_COMMITTER_DATE=$gitdate - git commit -m "$time $url" - fi - done -} - -main "$@" -- cgit v1.2.3