minimalist replacement for cgit
* just dump current HEAD, nobody cares about anything else anyway * and if they do, they can use git as once intended
This commit is contained in:
parent
f3d72a0103
commit
fb921ca742
26
git-dump
Executable file
26
git-dump
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# USAGE:
|
||||||
|
# Working directory needs to be git repo
|
||||||
|
# call with name of directory you'd like to dump to
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
DIR="/var/www/git-dump/$1"
|
||||||
|
|
||||||
|
files=`git ls-tree --full-tree -r --name-only HEAD`
|
||||||
|
|
||||||
|
rm -rf "$DIR"
|
||||||
|
|
||||||
|
echo "$files" | while IFS=$'\n' read -r f; do
|
||||||
|
subdir=`dirname $f`
|
||||||
|
fulldir="$DIR/$subdir"
|
||||||
|
mkdir -p "$fulldir"
|
||||||
|
fullpath="$DIR/$f.txt"
|
||||||
|
git show HEAD:"$f" > "$fullpath"
|
||||||
|
if file "$fullpath" | grep -q "text"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Binary file" > "$fullpath"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user