blob: c99c1d2c13493be217f1235a05667f26dc846594 (
plain)
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
|
#!/bin/bash
set -e
die () {
echo "$1" 1>&2
exit 1
}
DELTA_BIN=${1:-./target/release/delta}
DELTA="$DELTA_BIN --no-gitconfig --navigate"
# Trick delta into thinking that its pager is less, when really it is cat.
TEMPDIR=$(mktemp -d)
DELTA_TEST_PAGER=$TEMPDIR/less
echo cat > $DELTA_TEST_PAGER
chmod +x $DELTA_TEST_PAGER
export PAGER=$DELTA_TEST_PAGER
test_delta_less_hist_file_created () {
DELTA_HIST_FILE=~/.local/share/delta/lesshst
rm -f ~/.lesshst $DELTA_HIST_FILE
[ -e $DELTA_HIST_FILE ] && die "Expected $DELTA_HIST_FILE not to exist"
git -c core.pager="$DELTA" log -p HEAD~2...HEAD
[ -e $DELTA_HIST_FILE ] || die "Expected $DELTA_HIST_FILE to exist"
}
test_delta_less_hist_file_created
# Test it works with a custom LESSHISTFILE
DELTA_TEST_LESSHISTFILE=$(mktemp)
export LESSHISTFILE=TEMPDIR/delta.lesshst
test_delta_less_hist_file_created
# Cleanup
rm -r "$TEMPDIR"
|