add 'git credential' plumbing command
The credential API is in C, and not available to scripting languages. Expose the functionalities of the API by wrapping them into a new plumbing command "git credentials". In other words, replace the internal "test-credential" by an official Git command. Most documentation writen by: Jeff King <peff@peff.net> Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr> Signed-off-by: Kim Thuat Nguyen <Kim-Thuat.Nguyen@ensimag.imag.fr> Signed-off-by: Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fd378070c8
commit
e30b2feb1b
@ -4,10 +4,20 @@
|
||||
# stdout and stderr should be provided on stdin,
|
||||
# separated by "--".
|
||||
check() {
|
||||
credential_opts=
|
||||
credential_cmd=$1
|
||||
shift
|
||||
for arg in "$@"; do
|
||||
credential_opts="$credential_opts -c credential.helper='$arg'"
|
||||
done
|
||||
read_chunk >stdin &&
|
||||
read_chunk >expect-stdout &&
|
||||
read_chunk >expect-stderr &&
|
||||
test-credential "$@" <stdin >stdout 2>stderr &&
|
||||
if ! eval "git $credential_opts credential $credential_cmd <stdin >stdout 2>stderr"; then
|
||||
echo "git credential failed with code $?" &&
|
||||
cat stderr &&
|
||||
false
|
||||
fi &&
|
||||
test_cmp expect-stdout stdout &&
|
||||
test_cmp expect-stderr stderr
|
||||
}
|
||||
@ -41,7 +51,7 @@ reject() {
|
||||
echo protocol=$2
|
||||
echo host=$3
|
||||
echo username=$4
|
||||
) | test-credential reject $1
|
||||
) | git -c credential.helper=$1 credential reject
|
||||
}
|
||||
|
||||
helper_test() {
|
||||
|
Reference in New Issue
Block a user