Merge branch 'js/ci-sdk-download-fix'
[git/raj.git] / t / lib-httpd / apply-one-time-perl.sh
blob09a0abdff7c4775f5ba5fd50f5753b3aed35d60b
1 #!/bin/sh
3 # If "one-time-perl" exists in $HTTPD_ROOT_PATH, run perl on the HTTP response,
4 # using the contents of "one-time-perl" as the perl command to be run. If the
5 # response was modified as a result, delete "one-time-perl" so that subsequent
6 # HTTP responses are no longer modified.
8 # This can be used to simulate the effects of the repository changing in
9 # between HTTP request-response pairs.
10 if test -f one-time-perl
11 then
12 LC_ALL=C
13 export LC_ALL
15 "$GIT_EXEC_PATH/git-http-backend" >out
16 perl -pe "$(cat one-time-perl)" out >out_modified
18 if cmp -s out out_modified
19 then
20 cat out
21 else
22 cat out_modified
23 rm one-time-perl
25 else
26 "$GIT_EXEC_PATH/git-http-backend"