Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions askpass_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down