1#!/bin/sh
2
3# Try a set of credential helpers; the expected stdin,
4# stdout and stderr should be provided on stdin,
5# separated by "--".
6check() {
7 read_chunk >stdin &&
8 read_chunk >expect-stdout &&
9 read_chunk >expect-stderr &&
10 test-credential "$@" <stdin >stdout 2>stderr &&
11 test_cmp expect-stdout stdout &&
12 test_cmp expect-stderr stderr
13}
14
15read_chunk() {
16 while read line; do
17 case "$line" in
18 --) break ;;
19 *) echo "$line" ;;
20 esac
21 done
22}
23
24
25cat >askpass <<\EOF
26#!/bin/sh
27echo >&2 askpass: $*
28what=`echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z`
29echo "askpass-$what"
30EOF
31chmod +x askpass
32GIT_ASKPASS="$PWD/askpass"
33export GIT_ASKPASS