diff options
author | Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr> | 2012-06-24 13:39:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-25 11:55:51 -0700 |
commit | e30b2feb1b50c2d14d32dc3e6e41f7b20a677ff2 (patch) | |
tree | 364c41094e77b5d806ea0c2c07a77ffab499f2e0 /t/lib-credential.sh | |
parent | fd378070c8171ba33a9b1aeca37085e6dfbff35b (diff) | |
download | git-e30b2feb1b50c2d14d32dc3e6e41f7b20a677ff2.tar.gz |
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>
Diffstat (limited to 't/lib-credential.sh')
-rwxr-xr-x | t/lib-credential.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/t/lib-credential.sh b/t/lib-credential.sh index 4a37cd79e5..7c4826e4ee 100755 --- a/t/lib-credential.sh +++ b/t/lib-credential.sh @@ -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() { |