1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/bin/sh
set -e
set -x
if [ "$#" -ne 1 ]; then
echo 'Usage: test-gl-simple dirname' 1>&2
echo '(the directory will be created)' 1>&2
exit 1
fi
dir="$1"
cwd="$(pwd)"
: "${PYTHON3:=python3}"
: "${GIT:=git}"
: "${GITLESS:=$cwd/gl.py}"
gl="${PYTHON3} ${GITLESS}"
[ -d "$dir" ] || mkdir -- "$dir"
cd "$dir"
$gl init
echo 'This is a test.' > file1
$gl track file1
$GIT ls-files -v --full-name file1
$GIT status --short
echo 'This is only a test.' >> file1
$GIT status --short
if $gl track file1; then false; else true; fi
$GIT status --short
if $gl track non-existent; then false; else true; fi
$GIT status --short
$gl untrack file1
$GIT ls-files -v --full-name file1
$GIT status --short
$gl track file1
$GIT ls-files -v --full-name file1
$GIT status --short
$gl commit -m 'file1 commit'
$GIT status --short
if $gl commit -m 'nothing to commit'; then false; else true; fi
$GIT status --short
$gl history
|