git-p4: remove bash-ism in t9800

This works in both bash and dash: $ bash -c 'VAR=1 env' | grep VAR VAR=1 $ dash -c 'VAR=1 env' | grep VAR VAR=1 But environment variables assigned this way are not necessarily propagated through a function in POSIX compliant shells: $ bash -c 'f() { "$@" }; VAR=1 f "env"' | grep VAR VAR=1 $ dash -c 'f() { "$@" }; VAR=1 f "env"' | grep VAR Fix constructs like this, in particular, setting variables through test_must_fail. Based-on-patch-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Feb 26, 2012 at 10:37 UTC 09ccbd34f4fe37a682a10b23d86f915b2a8a9c28
1 file changed +15 -9
t/t9800-git-p4-basic.sh
+15 -9
@@ -234,8 +234,10 @@ test_expect_success 'refuse to preserve users without perms' '
234 git config git-p4.skipSubmitEditCheck true &&
235 echo "username-noperms: a change by alice" >>file1 &&
236 git commit --author "Alice <alice@localhost>" -m "perms: a change by alice" file1 &&
237 - P4EDITOR=touch P4USER=bob P4PASSWD=secret test_must_fail "$GITP4" commit --preserve-user &&
238 - test_must_fail git diff --exit-code HEAD..p4/master
237 + P4EDITOR=touch P4USER=bob P4PASSWD=secret &&
238 + export P4EDITOR P4USER P4PASSWD &&
239 + test_must_fail "$GITP4" commit --preserve-user &&
240 + ! git diff --exit-code HEAD..p4/master
241 )
242 '
243
@@ -250,13 +252,15 @@ test_expect_success 'preserve user where author is unknown to p4' '
252 git commit --author "Bob <bob@localhost>" -m "preserve: a change by bob" file1 &&
253 echo "username-unknown: a change by charlie" >>file1 &&
254 git commit --author "Charlie <charlie@localhost>" -m "preserve: a change by charlie" file1 &&
253 - P4EDITOR=touch P4USER=alice P4PASSWD=secret test_must_fail "$GITP4" commit --preserve-user &&
254 - test_must_fail git diff --exit-code HEAD..p4/master &&
255 + P4EDITOR=touch P4USER=alice P4PASSWD=secret &&
256 + export P4EDITOR P4USER P4PASSWD &&
257 + test_must_fail "$GITP4" commit --preserve-user &&
258 + ! git diff --exit-code HEAD..p4/master &&
259
260 echo "$0: repeat with allowMissingP4Users enabled" &&
261 git config git-p4.allowMissingP4Users true &&
262 git config git-p4.preserveUser true &&
259 - P4EDITOR=touch P4USER=alice P4PASSWD=secret "$GITP4" commit &&
263 + "$GITP4" commit &&
264 git diff --exit-code HEAD..p4/master &&
265 p4_check_commit_author file1 alice
266 )
@@ -275,20 +279,22 @@ test_expect_success 'not preserving user with mixed authorship' '
279 p4_add_user derek Derek &&
280
281 make_change_by_user usernamefile3 Derek derek@localhost &&
278 - P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
282 + P4EDITOR=cat P4USER=alice P4PASSWD=secret &&
283 + export P4EDITOR P4USER P4PASSWD &&
284 + "$GITP4" commit |\
285 grep "git author derek@localhost does not match" &&
286
287 make_change_by_user usernamefile3 Charlie charlie@localhost &&
282 - P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
288 + "$GITP4" commit |\
289 grep "git author charlie@localhost does not match" &&
290
291 make_change_by_user usernamefile3 alice alice@localhost &&
286 - P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" |\
292 + "$GITP4" commit |\
293 test_must_fail grep "git author.*does not match" &&
294
295 git config git-p4.skipUserNameCheck true &&
296 make_change_by_user usernamefile3 Charlie charlie@localhost &&
291 - P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
297 + "$GITP4" commit |\
298 test_must_fail grep "git author.*does not match" &&
299
300 p4_check_commit_author usernamefile3 alice