diff --git a/askpass_git.sh b/askpass_git.sh index 5a33a7c..8558362 100755 --- a/askpass_git.sh +++ b/askpass_git.sh @@ -17,10 +17,12 @@ fi # `git credential fill` requires the repo url match to consume the credentials stored by git-sync. # Askpass git only support repo started with "file://" which is used in test_e2e.sh. REPO=$(echo "$@" | grep -o "file://[^ ]*") -PASSWD=$(echo "url=${REPO}" | git credential fill | grep -o "password=.*") -# Test case much match the magic password below. -if [ "${PASSWD}" != "password=Lov3!k0os" ]; then - echo "invalid password ${PASSWD}, try Lov3!k0os next time." +OUTPUT=$(echo "url=${REPO}" | git credential fill) +USERNAME=$(echo ${OUTPUT} | grep -o "username=.*") +PASSWD=$(echo ${OUTPUT} | grep -o "password=.*") +# Test case must match the magic username and password below. +if [ "${PASSWD}" != "password=Lov3!k0os" || "${USERNAME}" != "gitsync@example.com" ]; then + echo "invalid username/password pair: ${USERNAME}:${PASSWD}, try gitsync@example.com:Lov3!k0os next time." exit 1 fi diff --git a/test_e2e.sh b/test_e2e.sh index c39e4c9..6178115 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -641,7 +641,7 @@ git -C "$REPO" commit -qam "$TESTCASE 1" # run with askpass_git but with wrong password GIT_SYNC \ --git=$ASKPASS_GIT \ - --username="you@example.com" \ + --username="gitsync@example.com" \ --password="I have no idea what the password is." \ --logtostderr \ --v=5 \ @@ -657,7 +657,7 @@ assert_file_absent "$ROOT"/link/file # run with askpass_git with correct password GIT_SYNC \ --git=$ASKPASS_GIT \ - --username="you@example.com" \ + --username="gitsync@example.com" \ --password="Lov3!k0os" \ --logtostderr \ --v=5 \