├── .gitattributes ├── .github └── workflows │ ├── build_and_test.yml │ └── bump.yml ├── .gitignore ├── CODEOWNERS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── buildenv ├── cicd-dev.groovy ├── cicd-stable.groovy ├── dev-patches └── PR1 │ ├── newline.patch │ ├── nogreph.patch │ ├── releasenamecollision-pack.patch │ └── releasenamecollision.patch ├── stable-patches ├── LICENSE ├── Makefile.patch ├── archive.c.patch ├── attr.c.patch ├── blame.c.patch ├── builtin.h.patch ├── builtin │ └── help.c ├── combine-diff.c.patch ├── config.c.patch ├── config.mak.uname.patch ├── configure.ac.patch ├── convert.c.patch ├── copy.c.patch ├── diff.c.patch ├── entry.c.patch ├── environment.c.patch ├── environment.h.patch ├── exec-cmd.c.patch ├── generate-perl.sh.patch ├── git-compat-util.h.patch ├── hash-object.c.patch ├── http.c.patch ├── lockfile.c.patch ├── object-file.c.patch ├── quote.c.patch ├── read-cache-ll.h.patch ├── read-cache.c.patch ├── test-lib.sh.patch └── utf8.c.patch └── tests ├── basicclone.sh ├── stepwiseclone.sh └── testtags.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | * text working-tree-encoding=ISO8859-1 2 | -------------------------------------------------------------------------------- /.github/workflows/build_and_test.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | permissions: 4 | contents: write 5 | statuses: write 6 | actions: read 7 | 8 | on: 9 | issue_comment: 10 | types: 11 | - created 12 | pull_request_target: 13 | types: [opened, synchronize, reopened] 14 | paths-ignore: 15 | - 'cicd*.groovy' 16 | - '**/LICENSE' 17 | - 'README.md' 18 | workflow_dispatch: 19 | 20 | jobs: 21 | build-and-test: 22 | if: (github.event.issue.pull_request && contains(github.event.comment.body, '/run tests')) || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' 23 | uses: zopencommunity/meta/.github/workflows/build_and_test.yml@main 24 | secrets: inherit 25 | -------------------------------------------------------------------------------- /.github/workflows/bump.yml: -------------------------------------------------------------------------------- 1 | name: 'Automatic version updates' 2 | 3 | permissions: 4 | contents: write 5 | statuses: write 6 | actions: read 7 | 8 | on: 9 | schedule: 10 | # minute hour dom month dow (UTC) 11 | - cron: '00 15 * * *' 12 | # enable manual trigger of version updates 13 | workflow_dispatch: 14 | jobs: 15 | bump: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@master 19 | - uses: zopencommunity/meta/actions@main 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.BUMP_TOKEN }} 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | git 2 | patches 3 | log 4 | install 5 | git-2.39.2 6 | v2.39.2 7 | git-compat-util 8 | git-manpages 9 | git-manpages.tar.xz 10 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo, unless a later match takes precedence, 2 | # They will be requested for review when someone opens a pull request. 3 | * @IgorTodorovskiIBM @MikeFultonDev 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | Log an issue for any question or problem you might have. When in doubt, log an issue, and 6 | any additional policies about what to include will be provided in the responses. The only 7 | exception is security disclosures which should be sent privately. 8 | 9 | Committers may direct you to another repository, ask for additional clarifications, and 10 | add appropriate metadata before the issue is addressed. 11 | 12 | ## Contributions 13 | 14 | Any change to resources in this repository must be through pull requests. This applies to all changes 15 | to documentation, code, binary files, etc. 16 | 17 | No pull request can be merged without being reviewed and approved. 18 | 19 | ## Validate your changes 20 | 21 | Verify that the project is working by running `zopen build`. 22 | 23 | ## Coding Guidelines 24 | 25 | When contributing your changes, please follow the following coding guidelines: 26 | * patches: patches should adhere to the coding guidelines from the original project repository. Make sure to add the original project's LICENSE file within the patches 27 | directory. 28 | * zopen framework files: (e.g. buildenv) - It is recommended that you follow the [Google Shell Style Guide](https://google.github.io/styleguide/shellguide.html) 29 | 30 | If you are generating a new project, we recommend that you use `zopen generate` to create the correct zopen file and directory structure. 31 | 32 | ### Commit message 33 | 34 | A good commit message should describe what changed and why. 35 | 36 | It should: 37 | * contain a short description of the change 38 | * be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names 39 | * be prefixed with one of the following words: 40 | * fix: bug fix 41 | * hotfix: urgent bug fix 42 | * feat: new or updated feature 43 | * docs: documentation updates 44 | * refactor: code refactoring (no functional change) 45 | * perf: performance improvement 46 | * test: tests and CI updates 47 | 48 | ### Developer's Certificate of Origin 1.1 49 | 50 |
51 | By making a contribution to this project, I certify that:
52 | 
53 |  (a) The contribution was created in whole or in part by me and I
54 |      have the right to submit it under the open source license
55 |      indicated in the file; or
56 | 
57 |  (b) The contribution is based upon previous work that, to the best
58 |      of my knowledge, is covered under an appropriate open source
59 |      license and I have the right under that license to submit that
60 |      work with modifications, whether created in whole or in part
61 |      by me, under the same open source license (unless I am
62 |      permitted to submit under a different license), as indicated
63 |      in the file; or
64 | 
65 |  (c) The contribution was provided directly to me by some other
66 |      person who certified (a), (b) or (c) and I have not modified
67 |      it.
68 | 
69 |  (d) I understand and agree that this project and the contribution
70 |      are public and that a record of the contribution (including all
71 |      personal information I submit with it, including my sign-off) is
72 |      maintained indefinitely and may be redistributed consistent with
73 |      this project or the open source license(s) involved.
74 | 
75 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Automatic version updates](https://github.com/ZOSOpenTools/gitport/actions/workflows/bump.yml/badge.svg)](https://github.com/ZOSOpenTools/gitport/actions/workflows/bump.yml) 2 | 3 | # Git 4 | 5 | The Git version control system 6 | 7 | # Installation and Usage 8 | 9 | Use the zopen package manager ([QuickStart Guide](https://zopen.community/#/Guides/QuickStart)) to install: 10 | ```bash 11 | zopen install git 12 | ``` 13 | 14 | # Building from Source 15 | 16 | 1. Clone the repository: 17 | ```bash 18 | git clone https://github.com/zopencommunity/gitport.git 19 | cd gitport 20 | ``` 21 | 2. Build using zopen: 22 | ```bash 23 | zopen build -vv 24 | ``` 25 | 26 | See the [zopen porting guide](https://zopen.community/#/Guides/Porting) for more details. 27 | 28 | # Documentation 29 | ## Encoding considerations 30 | Git on z/OS leverages Git's `.gitattributes` support to enable support for various encodings, documented [here](https://git-scm.com/docs/gitattributes). 31 | `.gitattributes` can be specified globally, or locally in repositories to determine the encoding of working tree files. 32 | 33 | ### Working-tree-encoding 34 | The `working-tree-encoding` attribute can be used to determine the working tree encoding. For example, 35 | to convert all files from Git's internal UTF-8 encoding to IBM-1047, you can specify the following working-tree-encoding in your .gitattributes file: 36 | ``` 37 | * text working-tree-encoding=IBM-1047 38 | ``` 39 | This will result in Git on z/OS tagging all files as IBM-1047 on checkout. 40 | 41 | If you want the working-tree-encoding to apply to the host platform only, then you can use: 42 | `platform-working-tree-encoding` where platform is substituted with the system name. 43 | 44 | On z/OS, platform is `zos`. Therefore, the .gitattributes would be: 45 | ``` 46 | * text zos-working-tree-encoding=IBM-1047 47 | ``` 48 | 49 | If no encoding is specified, the default UTF-8 encoding is used and all files are tagged as ISO8859-1. 50 | 51 | To find out all of the supported encodings by git, run `iconv -l`. 52 | 53 | When adding files, you need to make sure that the z/OS file tag matches the working-tree-encoding. Otherwise, you may encounter an error. 54 | 55 | **Important Note:** If you are relying on the zos-working-tree-encoding support and you are editing your git-managed files on a non-z/OS platform, make sure that the files are encoded in UTF-8 mode. This is because Git assumes such files are encoded in UTF-8 prior to conversion. See [the working-tree-encoding documentation](https://git-scm.com/docs/gitattributes#_working_tree_encoding) for more details. If you insist on editing your files in a different encoding, make sure to add the `working-tree-encoding` to the .gitattributes to reflect the codepage: 56 | 57 | ``` 58 | * zos-working-tree-encoding=ibm-1047 working-tree-encoding=iso8859-1 59 | ``` 60 | This indicates that the file will be encoded in IBM-1047 on z/OS, but on non-z/OS platforms, it will be encoded in iso8859-1. 61 | 62 | ### Encodings and z/OS File Tags (CCSIDs) 63 | 64 | **Note:** Git on z/OS now aligns the file tag (CCSID) with the git working-tree-encoding by default. Previously, there was a specific handling for UTF-8 encoded files. These files were tagged as ISO8859-1 (CCSID 819) due to z/OS Open Tools' behavior under _BPXK_AUTOCVT=ON, which doesn't auto-convert files tagged with the UTF-8 tag (CCSID 1208). 65 | Consequently, the default tag for UTF-8 encoded files is now UTF-8 (or CCSID 1208). 66 | 67 | To adjust the default tag for UTF-8, you can configure the git setting `core.utf8ccsid` to 819 using the following commands: 68 | 69 | - `git config --global core.utf8ccsid 819` # Global setting, 819 represents the CCSID for the UTF8 file tag 70 | - `git config core.utf8ccsid 819` # Local setting affecting the current repository 71 | 72 | Alternatively, you can set the GIT_UTF8_CCSID environment variable: 73 | 74 | - `export GIT_UTF8_CCSID=819` # Environment variable 75 | 76 | The environment variable takes precedence over the git config setting. 77 | 78 | #### Example 79 | Assuming you want to clone UTF-8 encoded files with the tag UTF8 or ccsid 819 as opposed to the default ccsid (1208): 80 | 81 | ``` 82 | git config --global core.utf8ccsid 819 # Set the UTF-8 ccsid 819 globally 83 | git clone https://github.com/git/git 84 | cd git 85 | ls -lT # you will notice that all files are now tagged as 819 86 | ``` 87 | 88 | ### Binary files 89 | To specify a binary encoding, you can use the binary attribute as follows: 90 | ``` 91 | *.png binary 92 | ``` 93 | This will tag all `*.png` files as binary. 94 | 95 | ### Untagged files 96 | Git on z/OS does not currently support adding `untagged` files. Files need to be tagged before 97 | they can be added. 98 | 99 | ### Multiple encodings 100 | You can specify multiple working-tree-encoding attributes, where the later attributes overrides the initial attributes in case of an overlap. 101 | ``` 102 | * text working-tree-encoding=IBM-1047 103 | *.png binary 104 | ``` 105 | 106 | ### Migration considerations 107 | If you are migrating from Rocket Software's Git, then the good news is that Git on z/OS should be compatible. 108 | 109 | If you encounter any issues, please open an issue under https://github.com/zopencommunity/gitport/issues. 110 | 111 | # Git Performance considerations 112 | 113 | This section provides various strategies to improve Git performance. It covers approaches that reduce the amount of data processed by Git, fine-tuning configuration parameters, and addresses specific considerations for encoding conversions in the working tree. Each section offers explanations and examples to help users optimize Git operations in large repositories, CI/CD environments, and systems with high I/O demands. 114 | 115 | ## 1. Data Reduction Strategies 116 | 117 | Data reduction strategies are centered around minimizing the amount of data that Git must download, process, or store. By reducing the data footprint, you not only decrease network usage and disk I/O but also lower the CPU cycles required during operations. 118 | 119 | ### Shallow Clones 120 | 121 | - **Purpose:** 122 | Shallow clones limit the history depth that Git downloads. Instead of cloning the entire commit history of a repository, a shallow clone (`--depth=n`) retrieves only the latest commits (often just the most recent commit). This is particularly useful in **CI/CD pipelines** or automated builds where the full commit history is not needed. 123 | 124 | - **Benefits:** 125 | - **Reduced Data Transfer:** Only a subset of the commit history is downloaded, which saves bandwidth. 126 | - **Faster Cloning:** Cloning operations become much quicker as less data is processed. 127 | - **Lower CPU and Memory Usage:** With fewer commits to process, the resource consumption is significantly reduced. 128 | 129 | - **Example Command:** 130 | ```bash 131 | git clone --depth=1 my-repo 132 | ``` 133 | This command tells Git to perform a shallow clone with a depth of 1, meaning only the latest commit is cloned. This is particularly useful in in CI/CD build pipelines where logs are not accessed. 134 | 135 | ### Sparse Checkouts 136 | 137 | - **Purpose:** 138 | Sparse checkouts allow you to restrict the working directory to a specific subset of files or directories within the repository. This is highly beneficial for large repositories where only a few directories are required for a particular task. 139 | 140 | - **Benefits:** 141 | - **Reduced Disk Usage:** Only the necessary files are checked out, saving disk space. 142 | - **Improved Performance:** Fewer files mean less overhead for file system operations, leading to faster checkout and status commands. 143 | 144 | - **Example Workflow:** 145 | 1. Clone the repository normally: 146 | ```bash 147 | git clone my-repo 148 | cd my-repo 149 | ``` 150 | 2. Initialize sparse checkout mode: 151 | ```bash 152 | git sparse-checkout init --cone 153 | ``` 154 | 3. Specify the directories to be checked out: 155 | ```bash 156 | git sparse-checkout set src include 157 | ``` 158 | This setup ensures that only the directories `src` and `include` are present in the working directory, thereby reducing unnecessary data processing. 159 | 160 | ### Avoid Downloading Large Binaries 161 | 162 | - **Purpose:** 163 | In repositories containing large binary files or blobs that are not needed for every operation, you can instruct Git to filter these out during the cloning process. This helps in managing bandwidth and disk space effectively. 164 | 165 | - **Benefits:** 166 | - **Efficient Network Usage:** By not downloading large blobs, you reduce the time and data needed for cloning. 167 | - **Lower Processing Overhead:** Git spends less time handling unnecessary large objects. 168 | 169 | - **Example Command:** 170 | ```bash 171 | git clone --filter=blob:none 172 | ``` 173 | This command uses the `--filter=blob:none` option to prevent Git from downloading any large file blobs, making the clone operation leaner and faster. 174 | 175 | --- 176 | 177 | ## 2. Additional Strategies 178 | 179 | Beyond data reduction, there are several additional strategies that can further enhance Git performance by optimizing internal Git processes and leveraging system resources more effectively. 180 | 181 | ### Advanced Parallelization 182 | 183 | - **Purpose:** 184 | Git can take advantage of multiple processors by parallelizing certain operations. This includes parallel checkouts and repack operations which are critical for large repositories. 185 | 186 | - **Benefits:** 187 | - **Reduced Checkout Time:** Parallel workers can process multiple files concurrently. 188 | - **Better Resource Utilization:** Full utilization of available CPU cores leads to overall performance improvement. 189 | 190 | - **Example Configuration:** 191 | ```bash 192 | git config --global checkout.workers -1 # Use all available cores 193 | git config --global checkout.thresholdForParallelism 1000 194 | ``` 195 | These settings instruct Git to use all available CPU cores for checkout operations and to trigger parallelism when the number of files exceeds a certain threshold. 196 | 197 | ### Compression and Garbage Collection 198 | 199 | * **Lower Compression Level (`core.compression`):** 200 | * **Purpose:** Reduce CPU usage and improves fetch and clone performance by decreasing or disabling Git object compression. 201 | * **Configuration:** 202 | ```bash 203 | git config --global core.compression # 0 for no compression, 1-9 for levels 204 | git config --global core.compression 0 # Disable compression 205 | ``` 206 | * **Consideration:** Trade-off between CPU and disk space. 207 | 208 | * **Minimize Garbage Collection (`gc.auto`):** 209 | * **Purpose:** Prevent performance dips by disabling automatic garbage collection. 210 | * **Configuration:** 211 | ```bash 212 | git config --global gc.auto 0 213 | ``` 214 | * **Consideration:** May require manual `git gc` periodically. 215 | 216 | ### Performance-Enhancing Features 217 | 218 | * **`feature.manyFiles` Optimizations:** 219 | * **Purpose:** Optimize for repositories with many files, improving commands like `git status` and `git checkout`. 220 | * **Configuration:** 221 | ```bash 222 | git config --global feature.manyFiles true 223 | ``` 224 | * **Sub-options:** `index.skipHash`, `index.version`, `core.untrackedCache`. 225 | 226 | * **`core.ignoreStat`:** 227 | * **Purpose:** Skip `lstat()` calls for change detection, beneficial if `lstat()` is slow on your system. 228 | * **Configuration:** 229 | ```bash 230 | git config --global core.ignoreStat true 231 | ``` 232 | * **Consideration:** Default is `false`. Evaluate `lstat()` performance on z/OS. 233 | 234 | ### Profiling and Diagnostics 235 | 236 | - **Purpose:** 237 | Diagnostic environment variables such as `GIT_TRACE` and `GIT_TRACE_PERFORMANCE` help identify bottlenecks in Git operations. With the added logs, this can enable targeted performance tuning based on actual system behavior. 238 | 239 | - **Benefits:** 240 | - **Insight into Operations:** Detailed trace logs can reveal which steps are consuming the most time. 241 | 242 | - **Usage:** 243 | Set the environment variable before running Git commands: 244 | ```bash 245 | export GIT_TRACE=1 246 | export GIT_TRACE_PERFORMANCE=1 247 | ``` 248 | This will output detailed trace information that can be analyzed to optimize performance further. 249 | 250 | 251 | ## 4. Working-Tree-Encoding: Performance Considerations 252 | 253 | The `working-tree-encoding` or `zos-working-tree-encoding` attribute is designed to repository contents to a different encoding in the working directory. Although this is useful for projects that operate on a different encoding, it comes at a performance cost due to the on-the-fly conversions performed by the `iconv` library. 254 | 255 | ### How Working-Tree-Encoding Works 256 | 257 | When you define a `working-tree-encoding` in a `.gitattributes` file, Git automatically converts files from the repository's storage encoding to the specified encoding in the working tree during checkout. Conversely, when files are added or modified, Git converts them back to the repository's encoding. 258 | 259 | - **Conversion Process:** 260 | This conversion is handled by the `iconv` library, a library that transforms the file's encoding. While this ensures that files are accessible in the desired format, it introduces additional CPU overhead. 261 | 262 | ### Performance Impact 263 | 264 | - **Using a Global Wildcard:** 265 | Applying a global wildcard (i.e., `*`) for the `working-tree-encoding` attribute means that every file in the repository will undergo this conversion. For example: 266 | ```gitattributes 267 | * text zos-working-tree-encoding=ibm-1047 268 | ``` 269 | **Impact:** 270 | - **High CPU Usage:** Every file, regardless of type, is subject to encoding conversion. 271 | - **Slower Operations:** In repositories with a large number of files, this can significantly slow down checkouts, status checks, and other file operations. 272 | 273 | ### Use More Specific Patterns to Reduce Overhead 274 | 275 | - **Targeting Specific File Types:** 276 | Instead of applying the encoding conversion universally, restrict it to only those file types that require a specific encoding. For example, you may only need to convert source files, such as `.cob` or `.c` files: 277 | ```gitattributes 278 | *.cob text zos-working-tree-encoding=ibm-1047 279 | *.c text zos-working-tree-encoding=ibm-1047 280 | ``` 281 | **Benefits:** 282 | - **Reduced Conversion Load:** Only a subset of files is processed by `iconv`, alleviating the performance penalty. 283 | - **Focused Resource Usage:** System resources are concentrated on files that actually benefit from encoding conversion, improving overall efficiency. 284 | 285 | 286 | ## Troubleshooting 287 | TBD 288 | 289 | ## Contributing 290 | Contributions are welcome! Please follow the [zopen contribution guidelines](https://github.com/zopencommunity/meta/blob/main/CONTRIBUTING.md). 291 | -------------------------------------------------------------------------------- /buildenv: -------------------------------------------------------------------------------- 1 | # 2 | export ZOPEN_BUILD_LINE="STABLE" 3 | export ZOPEN_CATEGORIES="development source_control" 4 | 5 | # bump: git-version /GIT_VERSION="(.*)"/ https://github.com/git/git.git|* 6 | GIT_VERSION="2.49.0" 7 | 8 | export ZOPEN_DEV_URL="https://github.com/git/git.git" 9 | export ZOPEN_DEV_DEPS="curl git make m4 perl autoconf automake help2man texinfo xz zlib openssl expat gettext coreutils diffutils bash tar check_python gawk zusage libpsl libssh2" 10 | 11 | export ZOPEN_STABLE_URL="https://github.com/git/git.git" 12 | export ZOPEN_STABLE_TAG="v${GIT_VERSION}" 13 | export ZOPEN_STABLE_DEPS="curl git make m4 perl autoconf automake help2man texinfo xz zlib openssl expat gettext gzip tar coreutils zoslib diffutils ncurses bash sed libpcre2 tar check_python gawk zusage libpsl libssh2" 14 | 15 | # 16 | # Note the 'man' tarball release is numbered independently from the 'git' release. 17 | # 18 | export ZOPEN_TARBALL_MAN_URL="https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-${GIT_VERSION}.tar.xz" 19 | 20 | export ZOPEN_RUNTIME_DEPS="perl bash less ncurses" # If building with shared libs, add openssl, curl 21 | 22 | export ZOPEN_BOOTSTRAP="make" 23 | export ZOPEN_BOOTSTRAP_OPTS="configure" 24 | 25 | export ZOPEN_MAKE="zopen_build_all" 26 | export ZOPEN_MAKE_OPTS="" 27 | export ZOPEN_INSTALL="zopen_install_all" 28 | export ZOPEN_INSTALL_OPTS="" 29 | export ZOPEN_CHECK_OPTS='test' 30 | export ZOPEN_COMP=CLANG 31 | 32 | export ZOPEN_EXTRA_CONFIGURE_OPTS="--with-zlib=\${ZLIB_HOME} --with-curl=\${CURL_HOME} --with-openssl=\${OPENSSL_HOME} --with-libpcre2=\${PCRE2_HOME}" 33 | 34 | export ZOPEN_EXTRA_CPPFLAGS="-I\${OPENSSL_HOME}/include -I\${GETTEXT_HOME}/include -I\${ZLIB_HOME}/include -I\${NCURSES_HOME}/include -I\${ZOPEN_ROOT}/patches/include -I\${CURL_HOME}/include -I\${EXPAT_HOME}/include" 35 | export ZOPEN_EXTRA_LDFLAGS="-L\${GETTEXT_HOME}/lib -L\${OPENSSL_HOME}/lib -L\${ZLIB_HOME}/lib -L\${NCURSES_HOME}/lib -L\${CURL_HOME}/lib -L\${EXPAT_HOME}/lib" 36 | export ZOPEN_EXTRA_LIBS="${ZOPEN_EXTRA_LIBS} -lz -lcurl -lssl -lcrypto" 37 | export ZOPEN_EXTRA_CFLAGS="-mzos-target=zosv2r5 -march=z13" 38 | export ZOPEN_SYSTEM_PREREQS="zos25" 39 | export CURL_LDFLAGS="-lcurl" 40 | export CURL_CFLAGS="-I\${CURL_HOME}/include" 41 | export CURL_CONFIG="no" 42 | 43 | zopen_init() { 44 | # prevent -dirty suffix 45 | echo "${GIT_VERSION}" > version 46 | } 47 | 48 | zopen_build_all() 49 | { 50 | make -j$ZOPEN_NUM_JOBS "$@" 51 | if [ $? -gt 0 ]; then 52 | return 4; 53 | fi 54 | (cd contrib/subtree && make -j$ZOPEN_NUM_JOBS "$@") 55 | if [ $? -gt 0 ]; then 56 | return 4; 57 | fi 58 | } 59 | 60 | zopen_install_all() 61 | { 62 | make -j$ZOPEN_NUM_JOBS install "$@" 63 | if [ $? -gt 0 ]; then 64 | return 4; 65 | fi 66 | (cd contrib/subtree && make -j$ZOPEN_NUM_JOBS install "$@") 67 | if [ $? -gt 0 ]; then 68 | return 4; 69 | fi 70 | # Copy new contributor tools git-jump as per instructions 71 | cp contrib/git-jump/git-jump $ZOPEN_INSTALL_DIR/bin 72 | 73 | mkdir -p $ZOPEN_INSTALL_DIR/share/bash-completion/completions 74 | cp -vr contrib/completion/* $ZOPEN_INSTALL_DIR/share/bash-completion/completions/ 75 | ln -s git-completion.bash $ZOPEN_INSTALL_DIR/share/bash-completion/completions/git 76 | } 77 | # Run a 'zopen_pre_check' routine to clean out any GIT environment variables 78 | # that might interfere with a new GIT operation during the test run 79 | # 80 | zopen_pre_check() 81 | { 82 | unset GIT_EXEC_PATH 83 | unset GIT_HOME 84 | unset GIT_MAN_PATH 85 | unset GIT_PAGER 86 | unset GIT_ROOT 87 | unset GIT_SHELL 88 | unset GIT_SSL_CAINFO 89 | unset GIT_TEMPLATE_DIR 90 | } 91 | 92 | zopen_check_results() 93 | { 94 | chk="$1/$2_check.log" 95 | successes=$(egrep "^ok [0-9]" "${chk}" | wc -l | xargs) 96 | 97 | failuretests=$(egrep "^not ok [0-9]" "${chk}") 98 | failures=$(echo "${failuretests}" | wc -l | xargs) 99 | totalTests=$((failures+successes)) 100 | 101 | echo "${failuretests}" >"$1/$2_check_failures.log" 102 | 103 | cat <&1 | grep -q "RUNTIME_PREFIX requested, but prefix computation failed" && exit 1 119 | 120 | mkdir -p "$1/etc" 121 | touch "$1/etc/gitconfig" # empty it out to avoid error with --system option 122 | touch "$1/etc/gitattributes" # empty it out to avoid error with --system option 123 | 124 | # Install a cacert.pem to be used (optionally) by the customer 125 | if ! $MYDIR/zopen update-cacert -f $1 ; then 126 | printSoftError "zopen update-cacert failed" 127 | return 4 128 | fi 129 | 130 | # Install man pages from ${GIT_MANPAGES_URL} 131 | GIT_SRC_DIR="${PWD}" 132 | GIT_ROOT="${GIT_SRC_DIR}/.." 133 | GIT_MAN_REL_DIR="git-manpages" 134 | GIT_MAN_DIR="${GIT_ROOT}/${GIT_MAN_REL_DIR}" 135 | GIT_MAN_TARBALL="${GIT_ROOT}/${GIT_MAN_REL_DIR}.tar.xz" 136 | 137 | if ! [ -d "${GIT_MAN_TARBALL}" ]; then 138 | if ! curl -L "${ZOPEN_TARBALL_MAN_URL}" -o "${GIT_MAN_TARBALL}" ; then 139 | printSoftError "Unable to download ${GIT_MAN_TARBALL} from ${ZOPEN_TARBALL_MAN_URL}" 140 | return 4 141 | fi 142 | fi 143 | if ! rm -rf "${GIT_MAN_DIR}" || ! mkdir "${GIT_MAN_DIR}" || ! tar -C "${GIT_MAN_DIR}" -axf "${GIT_MAN_TARBALL}" ; then 144 | printSoftError "Unable to untar and create directory ${GIT_MAN_DIR}" 145 | return 4 146 | fi 147 | if (! cd "${GIT_MAN_DIR}" || ! git init || ! git checkout -b master || ! git add . || ! git commit -m 'base' ) ; then 148 | printSoftError "Unable to set up local git repo for ${GIT_MAN_DIR}" 149 | return 4 150 | fi 151 | if ! make quick-install-man ; then 152 | printSoftError "Unable to install git man pages" 153 | return 4 154 | fi 155 | } 156 | 157 | zopen_append_to_env() 158 | { 159 | cat <release(negotiator); 10 | + negotiator->release_negotiator(negotiator); 11 | return ref; 12 | } 13 | 14 | @@ -1787,7 +1787,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, 15 | die("fsck failed"); 16 | 17 | if (negotiator) 18 | - negotiator->release(negotiator); 19 | + negotiator->release_negotiator(negotiator); 20 | 21 | oidset_clear(&common); 22 | return ref; 23 | -------------------------------------------------------------------------------- /dev-patches/PR1/releasenamecollision.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fetch-negotiator.h b/fetch-negotiator.h 2 | index e348905a1f..edc05418e2 100644 3 | --- a/fetch-negotiator.h 4 | +++ b/fetch-negotiator.h 5 | @@ -14,8 +14,8 @@ struct repository; 6 | * Then, when "have" lines are required, call next(). Call ack() to report what 7 | * the server tells us. 8 | * 9 | - * Once negotiation is done, call release(). The negotiator then cannot be used 10 | - * (unless reinitialized with fetch_negotiator_init()). 11 | + * Once negotiation is done, call release_negotiator(). The negotiator then 12 | + * cannot be used (unless reinitialized with fetch_negotiator_init()). 13 | */ 14 | struct fetch_negotiator { 15 | /* 16 | @@ -47,7 +47,7 @@ struct fetch_negotiator { 17 | */ 18 | int (*ack)(struct fetch_negotiator *, struct commit *); 19 | 20 | - void (*release)(struct fetch_negotiator *); 21 | + void (*release_negotiator)(struct fetch_negotiator *); 22 | 23 | /* internal use */ 24 | void *data; 25 | diff --git a/negotiator/default.c b/negotiator/default.c 26 | index 434189ae5d..157e884198 100644 27 | --- a/negotiator/default.c 28 | +++ b/negotiator/default.c 29 | @@ -153,7 +153,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c) 30 | return known_to_be_common; 31 | } 32 | 33 | -static void release(struct fetch_negotiator *n) 34 | +static void release_negotiator(struct fetch_negotiator *n) 35 | { 36 | clear_prio_queue(&((struct negotiation_state *)n->data)->rev_list); 37 | FREE_AND_NULL(n->data); 38 | @@ -166,7 +166,7 @@ void default_negotiator_init(struct fetch_negotiator *negotiator) 39 | negotiator->add_tip = add_tip; 40 | negotiator->next = next; 41 | negotiator->ack = ack; 42 | - negotiator->release = release; 43 | + negotiator->release_negotiator = release_negotiator; 44 | negotiator->data = CALLOC_ARRAY(ns, 1); 45 | ns->rev_list.compare = compare_commits_by_commit_date; 46 | 47 | diff --git a/negotiator/noop.c b/negotiator/noop.c 48 | index 60569b8350..c8c2f06245 100644 49 | --- a/negotiator/noop.c 50 | +++ b/negotiator/noop.c 51 | @@ -28,7 +28,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c) 52 | return 0; 53 | } 54 | 55 | -static void release(struct fetch_negotiator *n) 56 | +static void release_negotiator(struct fetch_negotiator *n) 57 | { 58 | /* nothing to release */ 59 | } 60 | @@ -39,6 +39,6 @@ void noop_negotiator_init(struct fetch_negotiator *negotiator) 61 | negotiator->add_tip = add_tip; 62 | negotiator->next = next; 63 | negotiator->ack = ack; 64 | - negotiator->release = release; 65 | + negotiator->release_negotiator = release_negotiator; 66 | negotiator->data = NULL; 67 | } 68 | diff --git a/negotiator/skipping.c b/negotiator/skipping.c 69 | index 1236e79224..5c604f73a7 100644 70 | --- a/negotiator/skipping.c 71 | +++ b/negotiator/skipping.c 72 | @@ -227,7 +227,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c) 73 | return known_to_be_common; 74 | } 75 | 76 | -static void release(struct fetch_negotiator *n) 77 | +static void release_negotiator(struct fetch_negotiator *n) 78 | { 79 | clear_prio_queue(&((struct data *)n->data)->rev_list); 80 | FREE_AND_NULL(n->data); 81 | @@ -240,7 +240,7 @@ void skipping_negotiator_init(struct fetch_negotiator *negotiator) 82 | negotiator->add_tip = add_tip; 83 | negotiator->next = next; 84 | negotiator->ack = ack; 85 | - negotiator->release = release; 86 | + negotiator->release_negotiator = release_negotiator; 87 | negotiator->data = CALLOC_ARRAY(data, 1); 88 | data->rev_list.compare = compare; 89 | 90 | -------------------------------------------------------------------------------- /stable-patches/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Note that the only valid version of the GPL as far as this project 3 | is concerned is _this_ particular version of the license (ie v2, not 4 | v2.2 or v3.x or whatever), unless explicitly otherwise stated. 5 | 6 | HOWEVER, in order to allow a migration to GPLv3 if that seems like 7 | a good idea, I also ask that people involved with the project make 8 | their preferences known. In particular, if you trust me to make that 9 | decision, you might note so in your copyright message, ie something 10 | like 11 | 12 | This file is licensed under the GPL v2, or a later version 13 | at the discretion of Linus. 14 | 15 | might avoid issues. But we can also just decide to synchronize and 16 | contact all copyright holders on record if/when the occasion arises. 17 | 18 | Linus Torvalds 19 | 20 | ---------------------------------------- 21 | 22 | GNU GENERAL PUBLIC LICENSE 23 | Version 2, June 1991 24 | 25 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 26 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 27 | Everyone is permitted to copy and distribute verbatim copies 28 | of this license document, but changing it is not allowed. 29 | 30 | Preamble 31 | 32 | The licenses for most software are designed to take away your 33 | freedom to share and change it. By contrast, the GNU General Public 34 | License is intended to guarantee your freedom to share and change free 35 | software--to make sure the software is free for all its users. This 36 | General Public License applies to most of the Free Software 37 | Foundation's software and to any other program whose authors commit to 38 | using it. (Some other Free Software Foundation software is covered by 39 | the GNU Lesser General Public License instead.) You can apply it to 40 | your programs, too. 41 | 42 | When we speak of free software, we are referring to freedom, not 43 | price. Our General Public Licenses are designed to make sure that you 44 | have the freedom to distribute copies of free software (and charge for 45 | this service if you wish), that you receive source code or can get it 46 | if you want it, that you can change the software or use pieces of it 47 | in new free programs; and that you know you can do these things. 48 | 49 | To protect your rights, we need to make restrictions that forbid 50 | anyone to deny you these rights or to ask you to surrender the rights. 51 | These restrictions translate to certain responsibilities for you if you 52 | distribute copies of the software, or if you modify it. 53 | 54 | For example, if you distribute copies of such a program, whether 55 | gratis or for a fee, you must give the recipients all the rights that 56 | you have. You must make sure that they, too, receive or can get the 57 | source code. And you must show them these terms so they know their 58 | rights. 59 | 60 | We protect your rights with two steps: (1) copyright the software, and 61 | (2) offer you this license which gives you legal permission to copy, 62 | distribute and/or modify the software. 63 | 64 | Also, for each author's protection and ours, we want to make certain 65 | that everyone understands that there is no warranty for this free 66 | software. If the software is modified by someone else and passed on, we 67 | want its recipients to know that what they have is not the original, so 68 | that any problems introduced by others will not reflect on the original 69 | authors' reputations. 70 | 71 | Finally, any free program is threatened constantly by software 72 | patents. We wish to avoid the danger that redistributors of a free 73 | program will individually obtain patent licenses, in effect making the 74 | program proprietary. To prevent this, we have made it clear that any 75 | patent must be licensed for everyone's free use or not licensed at all. 76 | 77 | The precise terms and conditions for copying, distribution and 78 | modification follow. 79 | 80 | GNU GENERAL PUBLIC LICENSE 81 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 82 | 83 | 0. This License applies to any program or other work which contains 84 | a notice placed by the copyright holder saying it may be distributed 85 | under the terms of this General Public License. The "Program", below, 86 | refers to any such program or work, and a "work based on the Program" 87 | means either the Program or any derivative work under copyright law: 88 | that is to say, a work containing the Program or a portion of it, 89 | either verbatim or with modifications and/or translated into another 90 | language. (Hereinafter, translation is included without limitation in 91 | the term "modification".) Each licensee is addressed as "you". 92 | 93 | Activities other than copying, distribution and modification are not 94 | covered by this License; they are outside its scope. The act of 95 | running the Program is not restricted, and the output from the Program 96 | is covered only if its contents constitute a work based on the 97 | Program (independent of having been made by running the Program). 98 | Whether that is true depends on what the Program does. 99 | 100 | 1. You may copy and distribute verbatim copies of the Program's 101 | source code as you receive it, in any medium, provided that you 102 | conspicuously and appropriately publish on each copy an appropriate 103 | copyright notice and disclaimer of warranty; keep intact all the 104 | notices that refer to this License and to the absence of any warranty; 105 | and give any other recipients of the Program a copy of this License 106 | along with the Program. 107 | 108 | You may charge a fee for the physical act of transferring a copy, and 109 | you may at your option offer warranty protection in exchange for a fee. 110 | 111 | 2. You may modify your copy or copies of the Program or any portion 112 | of it, thus forming a work based on the Program, and copy and 113 | distribute such modifications or work under the terms of Section 1 114 | above, provided that you also meet all of these conditions: 115 | 116 | a) You must cause the modified files to carry prominent notices 117 | stating that you changed the files and the date of any change. 118 | 119 | b) You must cause any work that you distribute or publish, that in 120 | whole or in part contains or is derived from the Program or any 121 | part thereof, to be licensed as a whole at no charge to all third 122 | parties under the terms of this License. 123 | 124 | c) If the modified program normally reads commands interactively 125 | when run, you must cause it, when started running for such 126 | interactive use in the most ordinary way, to print or display an 127 | announcement including an appropriate copyright notice and a 128 | notice that there is no warranty (or else, saying that you provide 129 | a warranty) and that users may redistribute the program under 130 | these conditions, and telling the user how to view a copy of this 131 | License. (Exception: if the Program itself is interactive but 132 | does not normally print such an announcement, your work based on 133 | the Program is not required to print an announcement.) 134 | 135 | These requirements apply to the modified work as a whole. If 136 | identifiable sections of that work are not derived from the Program, 137 | and can be reasonably considered independent and separate works in 138 | themselves, then this License, and its terms, do not apply to those 139 | sections when you distribute them as separate works. But when you 140 | distribute the same sections as part of a whole which is a work based 141 | on the Program, the distribution of the whole must be on the terms of 142 | this License, whose permissions for other licensees extend to the 143 | entire whole, and thus to each and every part regardless of who wrote it. 144 | 145 | Thus, it is not the intent of this section to claim rights or contest 146 | your rights to work written entirely by you; rather, the intent is to 147 | exercise the right to control the distribution of derivative or 148 | collective works based on the Program. 149 | 150 | In addition, mere aggregation of another work not based on the Program 151 | with the Program (or with a work based on the Program) on a volume of 152 | a storage or distribution medium does not bring the other work under 153 | the scope of this License. 154 | 155 | 3. You may copy and distribute the Program (or a work based on it, 156 | under Section 2) in object code or executable form under the terms of 157 | Sections 1 and 2 above provided that you also do one of the following: 158 | 159 | a) Accompany it with the complete corresponding machine-readable 160 | source code, which must be distributed under the terms of Sections 161 | 1 and 2 above on a medium customarily used for software interchange; or, 162 | 163 | b) Accompany it with a written offer, valid for at least three 164 | years, to give any third party, for a charge no more than your 165 | cost of physically performing source distribution, a complete 166 | machine-readable copy of the corresponding source code, to be 167 | distributed under the terms of Sections 1 and 2 above on a medium 168 | customarily used for software interchange; or, 169 | 170 | c) Accompany it with the information you received as to the offer 171 | to distribute corresponding source code. (This alternative is 172 | allowed only for noncommercial distribution and only if you 173 | received the program in object code or executable form with such 174 | an offer, in accord with Subsection b above.) 175 | 176 | The source code for a work means the preferred form of the work for 177 | making modifications to it. For an executable work, complete source 178 | code means all the source code for all modules it contains, plus any 179 | associated interface definition files, plus the scripts used to 180 | control compilation and installation of the executable. However, as a 181 | special exception, the source code distributed need not include 182 | anything that is normally distributed (in either source or binary 183 | form) with the major components (compiler, kernel, and so on) of the 184 | operating system on which the executable runs, unless that component 185 | itself accompanies the executable. 186 | 187 | If distribution of executable or object code is made by offering 188 | access to copy from a designated place, then offering equivalent 189 | access to copy the source code from the same place counts as 190 | distribution of the source code, even though third parties are not 191 | compelled to copy the source along with the object code. 192 | 193 | 4. You may not copy, modify, sublicense, or distribute the Program 194 | except as expressly provided under this License. Any attempt 195 | otherwise to copy, modify, sublicense or distribute the Program is 196 | void, and will automatically terminate your rights under this License. 197 | However, parties who have received copies, or rights, from you under 198 | this License will not have their licenses terminated so long as such 199 | parties remain in full compliance. 200 | 201 | 5. You are not required to accept this License, since you have not 202 | signed it. However, nothing else grants you permission to modify or 203 | distribute the Program or its derivative works. These actions are 204 | prohibited by law if you do not accept this License. Therefore, by 205 | modifying or distributing the Program (or any work based on the 206 | Program), you indicate your acceptance of this License to do so, and 207 | all its terms and conditions for copying, distributing or modifying 208 | the Program or works based on it. 209 | 210 | 6. Each time you redistribute the Program (or any work based on the 211 | Program), the recipient automatically receives a license from the 212 | original licensor to copy, distribute or modify the Program subject to 213 | these terms and conditions. You may not impose any further 214 | restrictions on the recipients' exercise of the rights granted herein. 215 | You are not responsible for enforcing compliance by third parties to 216 | this License. 217 | 218 | 7. If, as a consequence of a court judgment or allegation of patent 219 | infringement or for any other reason (not limited to patent issues), 220 | conditions are imposed on you (whether by court order, agreement or 221 | otherwise) that contradict the conditions of this License, they do not 222 | excuse you from the conditions of this License. If you cannot 223 | distribute so as to satisfy simultaneously your obligations under this 224 | License and any other pertinent obligations, then as a consequence you 225 | may not distribute the Program at all. For example, if a patent 226 | license would not permit royalty-free redistribution of the Program by 227 | all those who receive copies directly or indirectly through you, then 228 | the only way you could satisfy both it and this License would be to 229 | refrain entirely from distribution of the Program. 230 | 231 | If any portion of this section is held invalid or unenforceable under 232 | any particular circumstance, the balance of the section is intended to 233 | apply and the section as a whole is intended to apply in other 234 | circumstances. 235 | 236 | It is not the purpose of this section to induce you to infringe any 237 | patents or other property right claims or to contest validity of any 238 | such claims; this section has the sole purpose of protecting the 239 | integrity of the free software distribution system, which is 240 | implemented by public license practices. Many people have made 241 | generous contributions to the wide range of software distributed 242 | through that system in reliance on consistent application of that 243 | system; it is up to the author/donor to decide if he or she is willing 244 | to distribute software through any other system and a licensee cannot 245 | impose that choice. 246 | 247 | This section is intended to make thoroughly clear what is believed to 248 | be a consequence of the rest of this License. 249 | 250 | 8. If the distribution and/or use of the Program is restricted in 251 | certain countries either by patents or by copyrighted interfaces, the 252 | original copyright holder who places the Program under this License 253 | may add an explicit geographical distribution limitation excluding 254 | those countries, so that distribution is permitted only in or among 255 | countries not thus excluded. In such case, this License incorporates 256 | the limitation as if written in the body of this License. 257 | 258 | 9. The Free Software Foundation may publish revised and/or new versions 259 | of the General Public License from time to time. Such new versions will 260 | be similar in spirit to the present version, but may differ in detail to 261 | address new problems or concerns. 262 | 263 | Each version is given a distinguishing version number. If the Program 264 | specifies a version number of this License which applies to it and "any 265 | later version", you have the option of following the terms and conditions 266 | either of that version or of any later version published by the Free 267 | Software Foundation. If the Program does not specify a version number of 268 | this License, you may choose any version ever published by the Free Software 269 | Foundation. 270 | 271 | 10. If you wish to incorporate parts of the Program into other free 272 | programs whose distribution conditions are different, write to the author 273 | to ask for permission. For software which is copyrighted by the Free 274 | Software Foundation, write to the Free Software Foundation; we sometimes 275 | make exceptions for this. Our decision will be guided by the two goals 276 | of preserving the free status of all derivatives of our free software and 277 | of promoting the sharing and reuse of software generally. 278 | 279 | NO WARRANTY 280 | 281 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 282 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 283 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 284 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 285 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 286 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 287 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 288 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 289 | REPAIR OR CORRECTION. 290 | 291 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 292 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 293 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 294 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 295 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 296 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 297 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 298 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 299 | POSSIBILITY OF SUCH DAMAGES. 300 | 301 | END OF TERMS AND CONDITIONS 302 | 303 | How to Apply These Terms to Your New Programs 304 | 305 | If you develop a new program, and you want it to be of the greatest 306 | possible use to the public, the best way to achieve this is to make it 307 | free software which everyone can redistribute and change under these terms. 308 | 309 | To do so, attach the following notices to the program. It is safest 310 | to attach them to the start of each source file to most effectively 311 | convey the exclusion of warranty; and each file should have at least 312 | the "copyright" line and a pointer to where the full notice is found. 313 | 314 | 315 | Copyright (C) 316 | 317 | This program is free software; you can redistribute it and/or modify 318 | it under the terms of the GNU General Public License as published by 319 | the Free Software Foundation; either version 2 of the License, or 320 | (at your option) any later version. 321 | 322 | This program is distributed in the hope that it will be useful, 323 | but WITHOUT ANY WARRANTY; without even the implied warranty of 324 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 325 | GNU General Public License for more details. 326 | 327 | You should have received a copy of the GNU General Public License along 328 | with this program; if not, write to the Free Software Foundation, Inc., 329 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 330 | 331 | Also add information on how to contact you by electronic and paper mail. 332 | 333 | If the program is interactive, make it output a short notice like this 334 | when it starts in an interactive mode: 335 | 336 | Gnomovision version 69, Copyright (C) year name of author 337 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 338 | This is free software, and you are welcome to redistribute it 339 | under certain conditions; type `show c' for details. 340 | 341 | The hypothetical commands `show w' and `show c' should show the appropriate 342 | parts of the General Public License. Of course, the commands you use may 343 | be called something other than `show w' and `show c'; they could even be 344 | mouse-clicks or menu items--whatever suits your program. 345 | 346 | You should also get your employer (if you work as a programmer) or your 347 | school, if any, to sign a "copyright disclaimer" for the program, if 348 | necessary. Here is a sample; alter the names: 349 | 350 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 351 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 352 | 353 | , 1 April 1989 354 | Ty Coon, President of Vice 355 | 356 | This General Public License does not permit incorporating your program into 357 | proprietary programs. If your program is a subroutine library, you may 358 | consider it more useful to permit linking proprietary applications with the 359 | library. If this is what you want to do, use the GNU Lesser General 360 | Public License instead of this License. 361 | -------------------------------------------------------------------------------- /stable-patches/Makefile.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile b/Makefile 2 | index 97e8385b66..08ab16ee92 100644 3 | --- a/Makefile 4 | +++ b/Makefile 5 | @@ -20,6 +20,8 @@ include shared.mak 6 | # 7 | # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken. 8 | # 9 | +# Define SHELL_PATH_FOR_SCRIPTS to a POSIX shell if your /bin/sh is broken. 10 | +# 11 | # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend 12 | # to PATH if your tools in /usr/bin are broken. 13 | # 14 | @@ -215,6 +217,8 @@ include shared.mak 15 | # 16 | # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl). 17 | # 18 | +# Define PERL_PATH_FOR_SCRIPTS to a Perl binary if your /usr/bin/perl is broken. 19 | +# 20 | # Define NO_PERL if you do not want Perl scripts or libraries at all. 21 | # 22 | # Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled 23 | @@ -896,15 +900,22 @@ BINDIR_PROGRAMS_NO_X += git-cvsserver 24 | ifndef SHELL_PATH 25 | SHELL_PATH = /bin/sh 26 | endif 27 | +ifndef SHELL_PATH_FOR_SCRIPTS 28 | + SHELL_PATH_FOR_SCRIPTS = /bin/sh 29 | +endif 30 | ifndef PERL_PATH 31 | PERL_PATH = /usr/bin/perl 32 | endif 33 | +ifndef PERL_PATH_FOR_SCRIPTS 34 | + PERL_PATH_FOR_SCRIPTS = /usr/bin/perl 35 | +endif 36 | ifndef PYTHON_PATH 37 | PYTHON_PATH = /usr/bin/python 38 | endif 39 | 40 | export PERL_PATH 41 | export PYTHON_PATH 42 | +export PERL_PATH_FOR_SCRIPTS 43 | 44 | TEST_SHELL_PATH = $(SHELL_PATH) 45 | 46 | @@ -1372,7 +1383,7 @@ UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o 47 | 48 | # xdiff and reftable libs may in turn depend on what is in libgit.a 49 | GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE) 50 | -EXTLIBS = 51 | +EXTLIBS = $(ZOPEN_EXTRA_LIBS) 52 | 53 | GIT_USER_AGENT = git/$(GIT_VERSION) 54 | 55 | @@ -2298,9 +2309,10 @@ perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative)) 56 | gitwebdir_SQ = $(subst ','\'',$(gitwebdir)) 57 | gitwebstaticdir_SQ = $(subst ','\'',$(gitwebstaticdir)) 58 | 59 | -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 60 | +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH_FOR_SCRIPTS)) 61 | TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH)) 62 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) 63 | +PERL_PATH_FOR_SCRIPTS_SQ = $(subst ','\'',$(PERL_PATH_FOR_SCRIPTS)) 64 | PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) 65 | TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) 66 | DIFF_SQ = $(subst ','\'',$(DIFF)) 67 | @@ -2543,7 +2555,7 @@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt 68 | 69 | SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ 70 | $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\ 71 | - $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\ 72 | + $(gitwebdir_SQ):$(PERL_PATH_FOR_SCRIPTS_SQ):$(PAGER_ENV):\ 73 | $(perllibdir_SQ) 74 | GIT-SCRIPT-DEFINES: FORCE 75 | @FLAGS='$(SCRIPT_DEFINES)'; \ 76 | @@ -2794,7 +2806,7 @@ endif 77 | 78 | exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX 79 | exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \ 80 | - '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \ 81 | + '-DGIT_EXEC_PATH="$(gitexecdir_relative_SQ)"' \ 82 | '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \ 83 | '-DBINDIR="$(bindir_relative_SQ)"' \ 84 | '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' 85 | -------------------------------------------------------------------------------- /stable-patches/archive.c.patch: -------------------------------------------------------------------------------- 1 | diff --git i/builtin/archive.c w/builtin/archive.c 2 | index 13ea730..f0da605 100644 3 | --- i/builtin/archive.c 4 | +++ w/builtin/archive.c 5 | @@ -12,6 +12,10 @@ 6 | static void create_output_file(const char *output_file) 7 | { 8 | int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666); 9 | +#ifdef __MVS__ 10 | + if (__setfdbinary(output_fd)) 11 | + die_errno(_("could not tag archive file '%s'"), output_file); 12 | +#endif 13 | if (output_fd != 1) { 14 | if (dup2(output_fd, 1) < 0) 15 | die_errno(_("could not redirect output")); 16 | -------------------------------------------------------------------------------- /stable-patches/attr.c.patch: -------------------------------------------------------------------------------- 1 | diff --git i/attr.c w/attr.c 2 | index 0bd2750..9e17884 100644 3 | --- i/attr.c 4 | +++ w/attr.c 5 | @@ -873,9 +873,10 @@ static struct attr_stack *read_attr(struct index_state *istate, 6 | 7 | const char *git_attr_system_file(void) 8 | { 9 | - static const char *system_wide; 10 | + char *system_wide = xstrdup_or_null(getenv("GIT_ATTR_SYSTEM")); 11 | if (!system_wide) 12 | system_wide = system_path(ETC_GITATTRIBUTES); 13 | + normalize_path_copy(system_wide, system_wide); 14 | return system_wide; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /stable-patches/blame.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/blame.c b/blame.c 2 | index b830654..f2458c3 100644 3 | --- a/blame.c 4 | +++ b/blame.c 5 | @@ -267,6 +267,11 @@ static struct commit *fake_working_tree_commit(struct repository *r, 6 | if (strbuf_read(&buf, 0, 0) < 0) 7 | die_errno("failed to read from stdin"); 8 | } 9 | +#ifdef __MVS__ 10 | + int autocvtToASCII; 11 | + validate_codeset(r->index, path, &autocvtToASCII); 12 | + if (autocvtToASCII) 13 | +#endif 14 | convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0); 15 | origin->file.ptr = buf.buf; 16 | origin->file.size = buf.len; 17 | -------------------------------------------------------------------------------- /stable-patches/builtin.h.patch: -------------------------------------------------------------------------------- 1 | diff --git a/builtin.h b/builtin.h 2 | index f7b166b334..c7896cda4b 100644 3 | --- a/builtin.h 4 | +++ b/builtin.h 5 | @@ -253,5 +253,7 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix, struct repo 6 | int cmd_show_ref(int argc, const char **argv, const char *prefix, struct repository *repo); 7 | int cmd_pack_refs(int argc, const char **argv, const char *prefix, struct repository *repo); 8 | int cmd_replace(int argc, const char **argv, const char *prefix, struct repository *repo); 9 | - 10 | +#ifdef __MVS__ 11 | + extern int setbinaryfd(int); 12 | +#endif 13 | #endif 14 | -------------------------------------------------------------------------------- /stable-patches/builtin/help.c: -------------------------------------------------------------------------------- 1 | diff --git i/builtin/help.c w/builtin/help.c 2 | index c257079..9ae3815 100644 3 | --- i/builtin/help.c 4 | +++ w/builtin/help.c 5 | @@ -313,6 +313,14 @@ static void exec_man_man(const char *path, const char *page) 6 | warning_errno(_("failed to exec '%s'"), path); 7 | } 8 | 9 | +static void exec_man_zotman(const char *path, const char *page) 10 | +{ 11 | + if (!path) 12 | + path = "zotman"; 13 | + execlp(path, "zotman", page, (char *)NULL); 14 | + warning_errno(_("failed to exec '%s'"), path); 15 | +} 16 | + 17 | static void exec_man_cmd(const char *cmd, const char *page) 18 | { 19 | struct strbuf shell_cmd = STRBUF_INIT; 20 | @@ -335,6 +343,7 @@ static int supported_man_viewer(const char *name, size_t len) 21 | { 22 | return (!strncasecmp("man", name, len) || 23 | !strncasecmp("woman", name, len) || 24 | + !strncasecmp("zotman", name, len) || 25 | !strncasecmp("konqueror", name, len)); 26 | } 27 | 28 | @@ -478,6 +487,13 @@ static void exec_viewer(const char *name, const char *page) 29 | { 30 | const char *info = get_man_viewer_info(name); 31 | 32 | +#ifdef __MVS__ 33 | + if (!strcasecmp(name, "man")) 34 | + exec_man_zotman(info, page); 35 | + if (!strcasecmp(name, "zotman")) 36 | + exec_man_zotman(info, page); 37 | + else 38 | +#endif 39 | if (!strcasecmp(name, "man")) 40 | exec_man_man(info, page); 41 | else if (!strcasecmp(name, "woman")) 42 | -------------------------------------------------------------------------------- /stable-patches/combine-diff.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/combine-diff.c b/combine-diff.c 2 | index b0ece95..9e5ed73 100644 3 | --- a/combine-diff.c 4 | +++ b/combine-diff.c 5 | @@ -1077,6 +1077,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, 6 | ssize_t done; 7 | int is_file, i; 8 | 9 | +#ifdef __MVS__ 10 | + __disableautocvt(fd); 11 | +#endif 12 | + 13 | elem->mode = canon_mode(st.st_mode); 14 | /* if symlinks don't work, assume symlink if all parents 15 | * are symlinks 16 | -------------------------------------------------------------------------------- /stable-patches/config.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/config.c b/config.c 2 | index 50f2d17b39..8cc8aab4d2 100644 3 | --- a/config.c 4 | +++ b/config.c 5 | @@ -33,6 +33,9 @@ 6 | #include "object-store-ll.h" 7 | #include "pager.h" 8 | #include "path.h" 9 | +#ifdef __MVS__ 10 | +#include "read-cache-ll.h" 11 | +#endif 12 | #include "utf8.h" 13 | #include "color.h" 14 | #include "refs.h" 15 | @@ -1508,6 +1511,18 @@ static int git_default_core_config(const char *var, const char *value, 16 | return 0; 17 | } 18 | 19 | + #ifdef __MVS__ 20 | + if (!strcmp(var, "core.ignorefiletags")) { 21 | + ignore_file_tags = git_config_bool(var, value); 22 | + return 0; 23 | + } 24 | + 25 | + if (!strcmp(var, "core.utf8ccsid")) { 26 | + utf8_ccsid = git_config_ulong(var, value, ctx->kvi); 27 | + return 0; 28 | + } 29 | +#endif 30 | + 31 | if (!strcmp(var, "core.safecrlf")) { 32 | int eol_rndtrp_die; 33 | if (value && !strcasecmp(value, "warn")) { 34 | -------------------------------------------------------------------------------- /stable-patches/config.mak.uname.patch: -------------------------------------------------------------------------------- 1 | diff --git a/config.mak.uname b/config.mak.uname 2 | index d5112168a4..17716314c0 100644 3 | --- a/config.mak.uname 4 | +++ b/config.mak.uname 5 | @@ -639,12 +639,19 @@ ifeq ($(uname_S),NONSTOP_KERNEL) 6 | SHELL_PATH = /usr/coreutils/bin/bash 7 | endif 8 | ifeq ($(uname_S),OS/390) 9 | + PERL_PATH = perl 10 | + PERL_PATH_FOR_SCRIPTS = /bin/env perl 11 | + SHELL_PATH = bash 12 | + SHELL_PATH_FOR_SCRIPTS = /bin/env bash 13 | + PYTHON_PATH = python 14 | NO_SYS_POLL_H = YesPlease 15 | + RUNTIME_PREFIX = YesPlease 16 | NO_STRCASESTR = YesPlease 17 | NO_REGEX = YesPlease 18 | NO_MMAP = YesPlease 19 | NO_NSEC = YesPlease 20 | NO_STRLCPY = YesPlease 21 | + NO_MKDTEMP = YesPlease 22 | NO_MEMMEM = YesPlease 23 | NO_GECOS_IN_PWENT = YesPlease 24 | HAVE_STRINGS_H = YesPlease 25 | -------------------------------------------------------------------------------- /stable-patches/configure.ac.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure.ac b/configure.ac 2 | index 38ff866..c9cf5ac 100644 3 | --- a/configure.ac 4 | +++ b/configure.ac 5 | @@ -463,6 +463,9 @@ else 6 | CC_LD_DYNPATH=-Wl,+b, 7 | else 8 | CC_LD_DYNPATH= 9 | + if test "$(uname -s)" = "OS/390"; then 10 | + CC_LD_DYNPATH=-L 11 | + fi 12 | AC_MSG_WARN([linker does not support runtime path to dynamic libraries]) 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /stable-patches/convert.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/convert.c b/convert.c 2 | index c4ddc4de81..010515a085 100644 3 | --- a/convert.c 4 | +++ b/convert.c 5 | @@ -5,6 +5,7 @@ 6 | #include "config.h" 7 | #include "convert.h" 8 | #include "copy.h" 9 | +#include "environment.h" 10 | #include "gettext.h" 11 | #include "hex.h" 12 | #include "object-store-ll.h" 13 | @@ -384,12 +385,16 @@ static int check_roundtrip(const char *enc_name) 14 | static const char *default_encoding = "UTF-8"; 15 | 16 | static int encode_to_git(const char *path, const char *src, size_t src_len, 17 | - struct strbuf *buf, const char *enc, int conv_flags) 18 | + struct strbuf *buf, const char *enc, 19 | + enum convert_crlf_action attr_action, int conv_flags) 20 | { 21 | char *dst; 22 | size_t dst_len; 23 | int die_on_error = conv_flags & CONV_WRITE_OBJECT; 24 | 25 | + if (attr_action == CRLF_BINARY) { 26 | + return 0; 27 | + } 28 | /* 29 | * No encoding is specified or there is nothing to encode. 30 | * Tell the caller that the content was not modified. 31 | @@ -410,6 +415,12 @@ static int encode_to_git(const char *path, const char *src, size_t src_len, 32 | return 0; 33 | 34 | trace_encoding("source", path, enc, src, src_len); 35 | +#ifdef __MVS__ 36 | + // If UTF CCSID == 819 (ISO8859-1), do not convert ISO8859-1 tagged files 37 | + if (utf8_ccsid == 819 && strcasecmp("ISO8859-1", enc) == 0) 38 | + return 0; 39 | +#endif 40 | + 41 | dst = reencode_string_len(src, src_len, default_encoding, enc, 42 | &dst_len); 43 | if (!dst) { 44 | @@ -419,6 +430,9 @@ static int encode_to_git(const char *path, const char *src, size_t src_len, 45 | * would fail and we would leave the user with a messed-up 46 | * working tree. Let's try to avoid this by screaming loud. 47 | */ 48 | + if (attr_action == CRLF_BINARY) { 49 | + return 0; 50 | + } 51 | const char* msg = _("failed to encode '%s' from %s to %s"); 52 | if (die_on_error) 53 | die(msg, path, enc, default_encoding); 54 | @@ -475,10 +489,14 @@ static int encode_to_git(const char *path, const char *src, size_t src_len, 55 | } 56 | 57 | static int encode_to_worktree(const char *path, const char *src, size_t src_len, 58 | - struct strbuf *buf, const char *enc) 59 | + struct strbuf *buf, enum convert_crlf_action attr_action, 60 | + const char *enc) 61 | { 62 | char *dst; 63 | size_t dst_len; 64 | +if (attr_action == CRLF_BINARY) { 65 | + return 0; 66 | +} 67 | 68 | /* 69 | * No encoding is specified or there is nothing to encode. 70 | @@ -1309,18 +1327,36 @@ static int git_path_check_ident(struct attr_check_item *check) 71 | 72 | static struct attr_check *check; 73 | 74 | +static const char* get_platform() { 75 | + struct utsname uname_info; 76 | + 77 | + if (uname(&uname_info)) 78 | + die(_("uname() failed with error '%s' (%d)\n"), 79 | + strerror(errno), 80 | + errno); 81 | + 82 | + if (!strcmp(uname_info.sysname, "OS/390")) 83 | + return "zos"; 84 | + return uname_info.sysname; 85 | +} 86 | + 87 | void convert_attrs(struct index_state *istate, 88 | struct conv_attrs *ca, const char *path) 89 | { 90 | struct attr_check_item *ccheck = NULL; 91 | + struct strbuf platform_working_tree_encoding = STRBUF_INIT; 92 | + 93 | + strbuf_addf(&platform_working_tree_encoding, "%s-working-tree-encoding", get_platform()); 94 | 95 | if (!check) { 96 | check = attr_check_initl("crlf", "ident", "filter", 97 | "eol", "text", "working-tree-encoding", 98 | + platform_working_tree_encoding.buf, 99 | NULL); 100 | user_convert_tail = &user_convert; 101 | git_config(read_convert_config, NULL); 102 | } 103 | + strbuf_release(&platform_working_tree_encoding); 104 | 105 | git_check_attr(istate, path, check); 106 | ccheck = check->items; 107 | @@ -1341,6 +1377,8 @@ void convert_attrs(struct index_state *istate, 108 | ca->crlf_action = CRLF_TEXT_CRLF; 109 | } 110 | ca->working_tree_encoding = git_path_check_encoding(ccheck + 5); 111 | + if (git_path_check_encoding(ccheck + 6)) 112 | + ca->working_tree_encoding = git_path_check_encoding(ccheck + 6); 113 | 114 | /* Save attr and make a decision for action */ 115 | ca->attr_action = ca->crlf_action; 116 | @@ -1434,7 +1472,7 @@ int convert_to_git(struct index_state *istate, 117 | len = dst->len; 118 | } 119 | 120 | - ret |= encode_to_git(path, src, len, dst, ca.working_tree_encoding, conv_flags); 121 | + ret |= encode_to_git(path, src, len, dst, ca.working_tree_encoding, ca.attr_action, conv_flags); 122 | if (ret && dst) { 123 | src = dst->buf; 124 | len = dst->len; 125 | @@ -1462,7 +1500,7 @@ void convert_to_git_filter_fd(struct index_state *istate, 126 | if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL, NULL)) 127 | die(_("%s: clean filter '%s' failed"), path, ca.drv->name); 128 | 129 | - encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags); 130 | + encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, ca.attr_action, conv_flags); 131 | crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags); 132 | ident_to_git(dst->buf, dst->len, dst, ca.ident); 133 | } 134 | @@ -1494,7 +1532,7 @@ static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca, 135 | } 136 | } 137 | 138 | - ret |= encode_to_worktree(path, src, len, dst, ca->working_tree_encoding); 139 | + ret |= encode_to_worktree(path, src, len, dst, ca->attr_action, ca->working_tree_encoding); 140 | if (ret) { 141 | src = dst->buf; 142 | len = dst->len; 143 | -------------------------------------------------------------------------------- /stable-patches/copy.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/copy.c b/copy.c 2 | index 4de6a11..c5584d4 100644 3 | --- a/copy.c 4 | +++ b/copy.c 5 | @@ -12,6 +12,9 @@ int copy_fd(int ifd, int ofd) 6 | if (write_in_full(ofd, buffer, len) < 0) 7 | return COPY_WRITE_ERROR; 8 | } 9 | +#ifdef __MVS__ 10 | + __copyfdccsid(ifd, ofd); 11 | +#endif 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /stable-patches/diff.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/diff.c b/diff.c 2 | index 108c187577..3412fc392e 100644 3 | --- a/diff.c 4 | +++ b/diff.c 5 | @@ -4106,6 +4106,7 @@ int diff_populate_filespec(struct repository *r, 6 | int check_binary = options ? options->check_binary : 0; 7 | int err = 0; 8 | int conv_flags = global_conv_flags_eol; 9 | + int autocvtToASCII; 10 | /* 11 | * demote FAIL to WARN to allow inspecting the situation 12 | * instead of refusing. 13 | @@ -4178,9 +4179,18 @@ int diff_populate_filespec(struct repository *r, 14 | s->is_binary = 1; 15 | return 0; 16 | } 17 | +#ifdef __MVS__ 18 | + validate_codeset(r->index, s->path, &autocvtToASCII); 19 | +#endif 20 | fd = open(s->path, O_RDONLY); 21 | if (fd < 0) 22 | goto err_empty; 23 | + 24 | +#ifdef __MVS__ 25 | + if (!autocvtToASCII) 26 | + __disableautocvt(fd); 27 | +#endif 28 | + 29 | s->data = xmmap(NULL, s->size, PROT_READ, MAP_PRIVATE, fd, 0); 30 | close(fd); 31 | s->should_munmap = 1; 32 | @@ -4284,6 +4294,10 @@ static void prep_temp_blob(struct index_state *istate, 33 | blob = buf.buf; 34 | size = buf.len; 35 | } 36 | + 37 | +#ifdef __MVS__ 38 | + tag_file_as_working_tree_encoding(istate, path, temp->tempfile->fd); 39 | +#endif 40 | if (write_in_full(temp->tempfile->fd, blob, size) < 0 || 41 | close_tempfile_gently(temp->tempfile)) 42 | die_errno("unable to write temp-file"); 43 | -------------------------------------------------------------------------------- /stable-patches/entry.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/entry.c b/entry.c 2 | index 076e97e..5c19411 100644 3 | --- a/entry.c 4 | +++ b/entry.c 5 | @@ -126,6 +126,24 @@ int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st) 6 | return 0; 7 | } 8 | 9 | +#ifdef __MVS__ 10 | +void tag_file_as_working_tree_encoding(struct index_state *istate, char* path, int fd) { 11 | + struct conv_attrs ca; 12 | + convert_attrs(istate, &ca, path); 13 | + if (ca.attr_action != CRLF_BINARY) { 14 | + if (ca.working_tree_encoding) 15 | + __chgfdcodeset(fd, ca.working_tree_encoding); 16 | + else 17 | + __chgfdccsid(fd, utf8_ccsid); 18 | + } 19 | + else { 20 | + __setfdbinary(fd); 21 | + } 22 | + 23 | + __disableautocvt(fd); 24 | +} 25 | +#endif 26 | + 27 | static int streaming_write_entry(const struct cache_entry *ce, char *path, 28 | struct stream_filter *filter, 29 | const struct checkout *state, int to_tempfile, 30 | @@ -138,6 +156,10 @@ static int streaming_write_entry(const struct cache_entry *ce, char *path, 31 | if (fd < 0) 32 | return -1; 33 | 34 | +#ifdef __MVS__ 35 | + tag_file_as_working_tree_encoding(state->istate, path, fd); 36 | +#endif 37 | + 38 | result |= stream_blob_to_fd(fd, &ce->oid, filter, 1); 39 | *fstat_done = fstat_checkout_output(fd, state, statbuf); 40 | result |= close(fd); 41 | @@ -374,6 +396,10 @@ static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca 42 | return error_errno("unable to create file %s", path); 43 | } 44 | 45 | +#ifdef __MVS__ 46 | + tag_file_as_working_tree_encoding(state->istate, path, fd); 47 | +#endif 48 | + 49 | wrote = write_in_full(fd, new_blob, size); 50 | if (!to_tempfile) 51 | fstat_done = fstat_checkout_output(fd, state, &st); 52 | @@ -476,6 +502,25 @@ int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca, 53 | struct stat st; 54 | struct conv_attrs ca_buf; 55 | 56 | + 57 | +#ifdef __MVS__ 58 | + const char* git_utf8_ccsid_str = getenv("GIT_UTF8_CCSID"); 59 | + 60 | + if (git_utf8_ccsid_str != NULL) { 61 | + char* endptr; 62 | + errno = 0; 63 | + long conv = strtol(git_utf8_ccsid_str, &endptr, 10); 64 | + 65 | + if (!conv) { 66 | + perror("Error converting GIT_UTF8_CCSID to short"); 67 | + } else if (endptr == git_utf8_ccsid_str) { 68 | + fprintf(stderr, "No digits were found in GIT_UTF8_CCSID\n"); 69 | + } else { 70 | + utf8_ccsid = conv; 71 | + } 72 | + } 73 | +#endif 74 | + 75 | if (ce->ce_flags & CE_WT_REMOVE) { 76 | if (topath) 77 | /* 78 | -------------------------------------------------------------------------------- /stable-patches/environment.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/environment.c b/environment.c 2 | index 90632a39bc..b580112319 100644 3 | --- a/environment.c 4 | +++ b/environment.c 5 | @@ -51,6 +51,10 @@ const char *git_hooks_path; 6 | int zlib_compression_level = Z_BEST_SPEED; 7 | int pack_compression_level = Z_DEFAULT_COMPRESSION; 8 | int fsync_object_files = -1; 9 | +#ifdef __MVS__ 10 | +int ignore_file_tags = 0; 11 | +int utf8_ccsid = 1208; 12 | +#endif 13 | int use_fsync = -1; 14 | enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT; 15 | enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT; 16 | -------------------------------------------------------------------------------- /stable-patches/environment.h.patch: -------------------------------------------------------------------------------- 1 | diff --git a/environment.h b/environment.h 2 | index 923e12661e..ed3a77ae84 100644 3 | --- a/environment.h 4 | +++ b/environment.h 5 | @@ -169,7 +169,9 @@ extern size_t delta_base_cache_limit; 6 | extern unsigned long big_file_threshold; 7 | extern unsigned long pack_size_limit_cfg; 8 | extern int max_allowed_tree_depth; 9 | - 10 | +#ifdef __MVS__ 11 | +extern int utf8_ccsid; 12 | +#endif 13 | extern int core_preload_index; 14 | extern int precomposed_unicode; 15 | extern int protect_hfs; 16 | -------------------------------------------------------------------------------- /stable-patches/exec-cmd.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/exec-cmd.c b/exec-cmd.c 2 | index 507e67d528..494abf8cc2 100644 3 | --- a/exec-cmd.c 4 | +++ b/exec-cmd.c 5 | @@ -158,8 +158,8 @@ static int git_get_exec_path_darwin(struct strbuf *buf) 6 | */ 7 | static int git_get_exec_path_zos(struct strbuf *buf) 8 | { 9 | - char *dir = __getprogramdir(); 10 | - char *exe = getprogname(); 11 | + volatile char * volatile dir = __getprogramdir(); 12 | + volatile char * volatile exe = getprogname(); 13 | if (dir && exe) { 14 | strbuf_addf(buf, "%s/%s", dir, exe); 15 | return 0; 16 | -------------------------------------------------------------------------------- /stable-patches/generate-perl.sh.patch: -------------------------------------------------------------------------------- 1 | diff --git a/generate-perl.sh b/generate-perl.sh 2 | index 65f122ebfc..154ae533f8 100755 3 | --- a/generate-perl.sh 4 | +++ b/generate-perl.sh 5 | @@ -19,7 +19,7 @@ OUTPUT="$5" 6 | 7 | sed -e '1{' \ 8 | -e " /^#!.*perl/!b" \ 9 | - -e " s|#!.*perl|#!$PERL_PATH|" \ 10 | + -e " s|#!.*perl|#!$PERL_PATH_FOR_SCRIPTS|" \ 11 | -e " r $PERL_HEADER" \ 12 | -e ' G' \ 13 | -e '}' \ 14 | -------------------------------------------------------------------------------- /stable-patches/git-compat-util.h.patch: -------------------------------------------------------------------------------- 1 | diff --git a/git-compat-util.h b/git-compat-util.h 2 | index 7c2a6538e5..1d9713a421 100644 3 | --- a/git-compat-util.h 4 | +++ b/git-compat-util.h 5 | @@ -223,7 +223,11 @@ struct strbuf; 6 | #include 7 | #include 8 | #include 9 | +#define release stdlib_release 10 | +#define fetch stdlib_fetch 11 | #include 12 | +#undef fetch 13 | +#undef release 14 | #include 15 | #include 16 | #include 17 | -------------------------------------------------------------------------------- /stable-patches/hash-object.c.patch: -------------------------------------------------------------------------------- 1 | diff --git i/builtin/hash-object.c w/builtin/hash-object.c 2 | index a25f040..40ab473 100644 3 | --- i/builtin/hash-object.c 4 | +++ w/builtin/hash-object.c 5 | @@ -62,6 +62,10 @@ static void hash_object(const char *path, const char *type, const char *vpath, 6 | { 7 | int fd; 8 | fd = xopen(path, O_RDONLY); 9 | +#ifdef __MVS__ 10 | + if (__setfdbinary(fd)) 11 | + die_errno("Cannot set to binary '%s'", path); 12 | +#endif 13 | hash_fd(fd, type, vpath, flags, literally); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /stable-patches/http.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/http.c b/http.c 2 | index c8fc15aa11..d72d87f27e 100644 3 | --- a/http.c 4 | +++ b/http.c 5 | @@ -1073,7 +1073,6 @@ static CURL *get_curl_handle(void) 6 | if (ssl_cipherlist != NULL && *ssl_cipherlist) 7 | curl_easy_setopt(result, CURLOPT_SSL_CIPHER_LIST, 8 | ssl_cipherlist); 9 | - 10 | if (ssl_cert) 11 | curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert); 12 | if (ssl_cert_type) 13 | @@ -1336,6 +1335,10 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) 14 | set_from_env(&ssl_key_type, "GIT_SSL_KEY_TYPE"); 15 | set_from_env(&ssl_capath, "GIT_SSL_CAPATH"); 16 | set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO"); 17 | +#ifdef __MVS__ 18 | + if (!ssl_cainfo) 19 | + set_from_env(&ssl_cainfo, "ZOPEN_GIT_SSL_CAINFO"); 20 | +#endif 21 | 22 | set_from_env(&user_agent, "GIT_HTTP_USER_AGENT"); 23 | 24 | -------------------------------------------------------------------------------- /stable-patches/lockfile.c.patch: -------------------------------------------------------------------------------- 1 | diff --git i/lockfile.c w/lockfile.c 2 | index 1d5ed01..ca7ee77 100644 3 | --- i/lockfile.c 4 | +++ w/lockfile.c 5 | @@ -83,6 +83,9 @@ static int lock_file(struct lock_file *lk, const char *path, int flags, 6 | 7 | strbuf_addstr(&filename, LOCK_SUFFIX); 8 | lk->tempfile = create_tempfile_mode(filename.buf, mode); 9 | +#ifdef __MVS__ 10 | + __setfdbinary(lk->tempfile->fd); 11 | +#endif 12 | strbuf_release(&filename); 13 | return lk->tempfile ? lk->tempfile->fd : -1; 14 | } 15 | -------------------------------------------------------------------------------- /stable-patches/object-file.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/object-file.c b/object-file.c 2 | index 610b1f465c..9661518d01 100644 3 | --- a/object-file.c 4 | +++ b/object-file.c 5 | @@ -38,6 +38,12 @@ 6 | #include "loose.h" 7 | #include "object-file-convert.h" 8 | 9 | +#ifdef __MVS__ 10 | +#include <_Ccsid.h> 11 | +#include "read-cache-ll.h" 12 | +#endif 13 | + 14 | + 15 | /* The maximum size for an object header. */ 16 | #define MAX_HEADER_LEN 32 17 | 18 | @@ -2642,18 +2648,88 @@ int index_fd(struct index_state *istate, struct object_id *oid, 19 | return ret; 20 | } 21 | 22 | +#ifdef __MVS__ 23 | +void validate_codeset(struct index_state *istate, const char *path, int* autoconvertToASCII) { 24 | + struct conv_attrs ca; 25 | + struct stat st; 26 | + unsigned short attr_ccsid; 27 | + unsigned short file_ccsid; 28 | + 29 | + if (ignore_file_tags) 30 | + return; 31 | + 32 | + *autoconvertToASCII = 0; 33 | + convert_attrs(istate, &ca, path); 34 | + if (ca.attr_action == CRLF_BINARY) { 35 | + attr_ccsid = FT_BINARY; 36 | + } 37 | + else if (ca.working_tree_encoding) { 38 | + attr_ccsid = __toCcsid(ca.working_tree_encoding); 39 | + } 40 | + else { 41 | + attr_ccsid = utf8_ccsid; 42 | + } 43 | + 44 | + if (stat(path, &st) < 0) 45 | + return; 46 | + 47 | + file_ccsid = st.st_tag.ft_ccsid; 48 | + 49 | + if (file_ccsid == FT_UNTAGGED) { 50 | + die("File %s is untagged, set the correct file tag (using the chtag command).", path); 51 | + } 52 | + 53 | + if (attr_ccsid != file_ccsid) { 54 | + if (file_ccsid == 1047 && attr_ccsid == 819) { 55 | + *autoconvertToASCII = 1; 56 | + return; 57 | + } 58 | + // Allow tag mixing of 819 and 1208 59 | + if ((file_ccsid == 819 || file_ccsid == 1208) && (attr_ccsid == 1208 || attr_ccsid == 819)) { 60 | + return; 61 | + } 62 | + // Don't check for binary files, just add them 63 | + if (attr_ccsid == FT_BINARY) 64 | + return; 65 | + 66 | + char attr_csname[_XOPEN_PATH_MAX] = {0}; 67 | + char file_csname[_XOPEN_PATH_MAX] = {0}; 68 | + if (attr_ccsid != FT_BINARY) { 69 | + __toCSName(attr_ccsid, attr_csname); 70 | + } else { 71 | + snprintf(attr_csname, _XOPEN_PATH_MAX, "%s", "binary"); 72 | + } 73 | + if (file_ccsid != FT_BINARY) { 74 | + __toCSName(file_ccsid, file_csname); 75 | + } else { 76 | + snprintf(file_csname, _XOPEN_PATH_MAX, "%s", "binary"); 77 | + } 78 | + die("%s added file: file tag (%s) does not match working-tree-encoding (%s)", path, file_csname, attr_csname); 79 | + } 80 | +} 81 | +#endif 82 | + 83 | int index_path(struct index_state *istate, struct object_id *oid, 84 | const char *path, struct stat *st, unsigned flags) 85 | { 86 | int fd; 87 | struct strbuf sb = STRBUF_INIT; 88 | int rc = 0; 89 | + struct conv_attrs ca; 90 | + int autocvtToASCII; 91 | 92 | switch (st->st_mode & S_IFMT) { 93 | case S_IFREG: 94 | +#ifdef __MVS__ 95 | + validate_codeset(istate, path, &autocvtToASCII); 96 | +#endif 97 | fd = open(path, O_RDONLY); 98 | if (fd < 0) 99 | return error_errno("open(\"%s\")", path); 100 | +#ifdef __MVS__ 101 | + if (!autocvtToASCII) 102 | + __disableautocvt(fd); 103 | +#endif 104 | if (index_fd(istate, oid, fd, st, OBJ_BLOB, path, flags) < 0) 105 | return error(_("%s: failed to insert into database"), 106 | path); 107 | -------------------------------------------------------------------------------- /stable-patches/quote.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/quote.c b/quote.c 2 | index 3c05194496..3643312db7 100644 3 | --- a/quote.c 4 | +++ b/quote.c 5 | @@ -217,6 +217,8 @@ int sq_dequote_to_strvec(char *arg, struct strvec *array) 6 | */ 7 | #define X8(x) x, x, x, x, x, x, x, x 8 | #define X16(x) X8(x), X8(x) 9 | +#define X64(x) X16(x), X16(x), X16(x), X16(x) 10 | +#define X128(x) X64(x), X64(x) 11 | static signed char const cq_lookup[256] = { 12 | /* 0 1 2 3 4 5 6 7 */ 13 | /* 0x00 */ 1, 1, 1, 1, 1, 1, 1, 'a', 14 | @@ -227,7 +229,7 @@ static signed char const cq_lookup[256] = { 15 | /* 0x58 */ -1, -1, -1, -1,'\\', -1, -1, -1, 16 | /* 0x60 */ X16(-1), X8(-1), 17 | /* 0x78 */ -1, -1, -1, -1, -1, -1, -1, 1, 18 | - /* 0x80 */ /* set to 0 */ 19 | + /* 0x80 */ X128(-1) 20 | }; 21 | 22 | static inline int cq_must_quote(char c) 23 | -------------------------------------------------------------------------------- /stable-patches/read-cache-ll.h.patch: -------------------------------------------------------------------------------- 1 | diff --git a/read-cache-ll.h b/read-cache-ll.h 2 | index 9a1a7ed..a99eef7 100644 3 | --- a/read-cache-ll.h 4 | +++ b/read-cache-ll.h 5 | @@ -466,6 +466,10 @@ struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry 6 | 7 | void set_alternate_index_output(const char *); 8 | 9 | +#ifdef __MVS__ 10 | +extern int ignore_file_tags; 11 | +#endif 12 | + 13 | extern int verify_index_checksum; 14 | extern int verify_ce_order; 15 | 16 | -------------------------------------------------------------------------------- /stable-patches/read-cache.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/read-cache.c b/read-cache.c 2 | index b09128b..7bc57dd 100644 3 | --- a/read-cache.c 4 | +++ b/read-cache.c 5 | @@ -244,6 +244,9 @@ static int ce_compare_data(struct index_state *istate, 6 | int fd = git_open_cloexec(ce->name, O_RDONLY); 7 | 8 | if (fd >= 0) { 9 | +#ifdef __MVS__ 10 | + __disableautocvt(fd); 11 | +#endif 12 | struct object_id oid; 13 | if (!index_fd(istate, &oid, fd, st, OBJ_BLOB, ce->name, 0)) 14 | match = !oideq(&oid, &ce->oid); 15 | -------------------------------------------------------------------------------- /stable-patches/test-lib.sh.patch: -------------------------------------------------------------------------------- 1 | diff --git a/t/test-lib.sh b/t/test-lib.sh 2 | index a65df2f..99c6d57 100644 3 | --- a/t/test-lib.sh 4 | +++ b/t/test-lib.sh 5 | @@ -1629,7 +1629,7 @@ fi 6 | 7 | # Use -P to resolve symlinks in our working directory so that the cwd 8 | # in subprocesses like git equals our $PWD (for pathname comparisons). 9 | -cd -P "$TRASH_DIRECTORY" || BAIL_OUT "cannot cd -P to \"$TRASH_DIRECTORY\"" 10 | +cd "$TRASH_DIRECTORY" || BAIL_OUT "cannot cd -P to \"$TRASH_DIRECTORY\"" 11 | 12 | start_test_output "$0" 13 | 14 | -------------------------------------------------------------------------------- /stable-patches/utf8.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/utf8.c b/utf8.c 2 | index 35a0251939..b5877f22f0 100644 3 | --- a/utf8.c 4 | +++ b/utf8.c 5 | @@ -3,6 +3,9 @@ 6 | #include "git-compat-util.h" 7 | #include "strbuf.h" 8 | #include "utf8.h" 9 | +#ifdef __MVS__ 10 | +extern int utf8_ccsid; 11 | +#endif 12 | 13 | /* This code is originally from https://www.cl.cam.ac.uk/~mgk25/ucs/ */ 14 | 15 | @@ -592,6 +595,20 @@ char *reencode_string_len(const char *in, size_t insz, 16 | #endif 17 | } 18 | 19 | +#ifdef __MVS__ 20 | + if (utf8_ccsid == 819) { 21 | + //HACK: For backwards compat UTF CCSID=819, ISO8859-1 really means utf-8 in the z/OS world 22 | + if (strcasecmp("ISO8859-1", in_encoding) == 0) { 23 | + in_encoding = "UTF-8"; 24 | + out_encoding = "UTF-8"; 25 | + } 26 | + if (strcasecmp("ISO8859-1", out_encoding) == 0) { 27 | + in_encoding = "UTF-8"; 28 | + out_encoding = "UTF-8"; 29 | + } 30 | + } 31 | +#endif 32 | + 33 | conv = iconv_open(out_encoding, in_encoding); 34 | if (conv == (iconv_t) -1) { 35 | in_encoding = fallback_encoding(in_encoding); 36 | -------------------------------------------------------------------------------- /tests/basicclone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mydir=$(cd $(dirname $0) && echo $PWD) 3 | 4 | # 5 | # The following is a bit hokey... might not always work 6 | # 7 | gitdir="${mydir}/../git-*" 8 | if ! [ -d ${gitdir} ] ; then 9 | echo "Unable to find git dev driver" >&2 10 | exit 99 11 | fi 12 | absgitdir=$(cd ${gitdir} && echo $PWD) 13 | 14 | # 15 | # First, clean up the environment 16 | # 17 | unset GIT_EXEC_PATH 18 | unset GIT_HOME 19 | unset GIT_MAN_PATH 20 | unset GIT_PAGER 21 | unset GIT_ROOT 22 | unset GIT_SHELL 23 | unset GIT_SSL_CAINFO 24 | unset GIT_TEMPLATE_DIR 25 | 26 | export PATH=/bin:/usr/bin:${absgitdir} 27 | unset LIBPATH 28 | 29 | export GIT_CONFIG_NOSYSTEM 30 | 31 | tmpdir="/tmp/git-$$" 32 | mkdir "${tmpdir}" || exit 99 33 | cd "${tmpdir}" || exit 99 34 | touch ".gitconfig" || exit 99 35 | 36 | export GIT_TEMPLATE_DIR='/fultonm/zopen/dev/gitport/git-2.9.5/templates/blt' 37 | 38 | # (MSF - empty git works) if git clone git@github.com:ZOSOpenTools/gittest_empty.git >gitclone.out 2>gitclone.err ; then 39 | if git clone git@github.com:ZOSOpenTools/zotsampleport.git >gitclone.out 2>gitclone.err ; then 40 | echo "Test passed" 41 | exit 0 42 | else 43 | echo "git clone failed" >&2 44 | echo "See $tmpdir/gitclone.* for results" >&2 45 | exit 4 46 | fi 47 | 48 | -------------------------------------------------------------------------------- /tests/stepwiseclone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mydir=$(cd $(dirname $0) && echo $PWD) 3 | 4 | # 5 | # The following is a bit hokey... might not always work 6 | # 7 | gitdir="${mydir}/../git-*" 8 | if ! [ -d ${gitdir} ] ; then 9 | echo "Unable to find git dev driver" >&2 10 | exit 99 11 | fi 12 | absgitdir=$(cd ${gitdir} && echo $PWD) 13 | 14 | # 15 | # First, clean up the environment 16 | # 17 | unset GIT_EXEC_PATH 18 | unset GIT_HOME 19 | unset GIT_MAN_PATH 20 | unset GIT_PAGER 21 | unset GIT_ROOT 22 | unset GIT_SHELL 23 | unset GIT_SSL_CAINFO 24 | unset GIT_TEMPLATE_DIR 25 | 26 | export PATH=/bin:/usr/bin:${absgitdir} 27 | unset LIBPATH 28 | 29 | export GIT_CONFIG_NOSYSTEM 30 | 31 | tmpdir="/tmp/git-$$" 32 | mkdir "${tmpdir}" || exit 99 33 | cd "${tmpdir}" || exit 99 34 | touch ".gitconfig" || exit 99 35 | 36 | export GIT_TEMPLATE_DIR='/fultonm/zopen/dev/gitport/git-2.9.5/templates/blt' 37 | 38 | gitrepo="zotsampleport" 39 | gitrepourl="git@github.com:ZOSOpenTools/${gitrepo}.git" 40 | main="main" 41 | 42 | if ! mkdir "${gitrepo}" ; then 43 | echo "Unable to create ${gitrepo} directory" >&2 44 | exit 99 45 | fi 46 | 47 | if ! cd "${gitrepo}" ; then 48 | echo "Unable to cd into ${gitrepo} directory" >&2 49 | exit 99 50 | fi 51 | 52 | if ! git init ; then 53 | echo "Unable to create empty repo" >&2 54 | exit 99 55 | fi 56 | 57 | if ! git remote add origin "${gitrepourl}" ; then 58 | echo "Unable to connect to ${gitrepourl}" >&2 59 | exit 99 60 | fi 61 | 62 | if ! git fetch --all ; then 63 | echo "Unable to fetch from ${gitrepourl}" >&2 64 | exit 99 65 | fi 66 | 67 | if ! git checkout --track "origin/${main}" ; then 68 | echo "Unable to checkout to ${gitrepourl}/${main}" >&2 69 | exit 99 70 | fi 71 | 72 | -------------------------------------------------------------------------------- /tests/testtags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mydir=$(cd $(dirname $0) && echo $PWD) 5 | 6 | # The following is a bit hokey... might not always work 7 | # 8 | gitdir="${mydir}/../git-2.38.1" 9 | echo $gitdir 10 | if ! [ -d "${gitdir}" ] ; then 11 | echo "Unable to find git dev driver" >&2 12 | exit 99 13 | fi 14 | absgitdir=$(cd ${gitdir} && echo $PWD) 15 | 16 | export PATH=/bin:/usr/bin:${absgitdir} 17 | 18 | tmpdir="/tmp/git-$$" 19 | mkdir "${tmpdir}" || exit 99 20 | cd "${tmpdir}" || exit 99 21 | touch ".gitconfig" || exit 99 22 | echo $PWD 23 | 24 | export GIT_TEMPLATE_DIR="${mydir}/../git-2.38.1/templates/blt" 25 | export GIT_EXEC_PATH="${mydir}/../git-2.38.1/libexec/git-core" 26 | gitrepourl="git@github.com:IgorTodorovskiIBM/EBCDICProject.git" 27 | git clone $gitrepourl 28 | 29 | cat > expected.txt < ../actual.txt 38 | iconv -f IBM-037 -t IBM-1047 my_037.txt > my_1047.txt 39 | chtag -tc 1047 my_1047.txt 40 | cat README.md ascii.txt my_1047.txt > ../actual2.txt 41 | cd .. 42 | diff actual.txt expected.txt 43 | 44 | cat > expected2.txt <