Skip to content

Commit 68f3c07

Browse files
peffgitster
authored andcommitted
t5541: fix url scrubbing test when GPG is not set
When the GPG prereq is not set, we do not run test 34. That test changes the directory of the test script as a side effect (something we usually frown on, but which matches the style of the rest of this script). When test 35 (the url-scrubbing test) runs, it expects to be in the directory from test 34. If it's not, the test fails; we are in a different sub-repo, our test-commit is built on a different history, and the push becomes a non-fast-forward. We can fix this by unconditionally moving to the directory we expect (again, against our usual style but matching how the rest of the script operates). As an additional protection, let's also switch from "make a new commit and push to master" to just "push to a new branch". We don't care about the branch name; we just want _some_ ref update to trigger the status output. Pushing to a new branch is less likely to run into problems with force-updates, changing the checked-out branch, etc. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 882d49c commit 68f3c07

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t5541-http-push-smart.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,10 @@ test_expect_success GPG 'push with post-receive to inspect certificate' '
369369
'
370370

371371
test_expect_success 'push status output scrubs password' '
372-
test_commit scrub &&
373-
git push --porcelain "$HTTPD_URL_USER_PASS/smart/test_repo.git" >status &&
372+
cd "$ROOT_PATH/test_repo_clone" &&
373+
git push --porcelain \
374+
"$HTTPD_URL_USER_PASS/smart/test_repo.git" \
375+
+HEAD:scrub >status &&
374376
# should have been scrubbed down to vanilla URL
375377
grep "^To $HTTPD_URL/smart/test_repo.git" status
376378
'

0 commit comments

Comments
 (0)