|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: SoC 2025 Applicant Microprojects |
| 4 | +--- |
| 5 | + |
| 6 | +## Introduction |
| 7 | + |
| 8 | +First make sure you read and understand |
| 9 | +[our general guidelines and suggestions for microprojects](https://git.github.io/General-Microproject-Information). |
| 10 | + |
| 11 | +There are some suggestions on how you can find some microprojects on your own in the document. |
| 12 | + |
| 13 | +## Ideas for microprojects |
| 14 | + |
| 15 | +### Fix Sign Comparison Warnings in Git's Codebase |
| 16 | + |
| 17 | +Help improve Git's code quality by fixing sign comparison warnings in files that |
| 18 | +currently disable these warnings. The goal is to remove instances of |
| 19 | +`DISABLE_SIGN_COMPARE_WARNINGS` macro and fix the underlying issues properly. |
| 20 | + |
| 21 | +#### Steps to Complete |
| 22 | +1. Find a C source file that contains `#define DISABLE_SIGN_COMPARE_WARNINGS` |
| 23 | +2. Remove this #define |
| 24 | +3. Build Git with `DEVELOPER=1` to enable compiler warnings. The `DEVLEOPER` |
| 25 | + can be specified in your `config.mak` or as follows |
| 26 | + |
| 27 | + ```sh |
| 28 | + make DEVELOPER=1 -j4 |
| 29 | + ``` |
| 30 | + |
| 31 | +4. Fix all `-Wsign-compare` warnings that appear for that file: |
| 32 | + - Pay attention to comparisons between signed and unsigned integers |
| 33 | + - Modify variable types or add appropriate casts as needed |
| 34 | + - Ensure the fixes don't change the code's behavior |
| 35 | + |
| 36 | +#### Notes |
| 37 | +- Each file should be handled in a separate patch |
| 38 | +- Follow Git's commit message conventions |
| 39 | +- Test your changes thoroughly |
| 40 | +- This is part of an ongoing effort to enable `-Wsign-compare` globally |
| 41 | + |
| 42 | +#### Related Patches |
| 43 | +For context on why this is a crucial improvement to Git's codebase, checkout |
| 44 | +[this e-mail ](https://public-inbox.org/git/[email protected]/) |
| 45 | +by Patrick Steinhardt. |
| 46 | + |
| 47 | + |
| 48 | +### Modernize Test Path Checking in Git's Test Suite |
| 49 | + |
| 50 | +Help improve Git's test suite by converting old-style path checks to use modern |
| 51 | +helper functions. We'll be replacing basic shell test commands like `test -f` |
| 52 | +with Git's dedicated test helpers like `test_path_is_file`. |
| 53 | + |
| 54 | +#### Steps to Complete |
| 55 | +1. Find a test script using old-style path checks: |
| 56 | +```sh |
| 57 | +git grep "test -[efd]" t/ |
| 58 | +``` |
| 59 | + |
| 60 | +2. Look for patterns like: |
| 61 | +```sh |
| 62 | +test -f path/to/file # old way |
| 63 | +test_path_is_file path/to/file # new way |
| 64 | + |
| 65 | +test -d some/directory # old way |
| 66 | +test_path_is_dir some/directory # new way |
| 67 | +``` |
| 68 | + |
| 69 | +3. Important: Only replace checks that are actually testing for conditions, not |
| 70 | + those used in flow control. For example: |
| 71 | +```sh |
| 72 | +# DON'T change this - it's flow control |
| 73 | +if test -e "file.txt"; then |
| 74 | + do_something |
| 75 | +fi |
| 76 | + |
| 77 | +# DO change this - it's a test assertion |
| 78 | +test -e "file.txt" || error "file.txt should exist" |
| 79 | +``` |
| 80 | + |
| 81 | +#### Notes |
| 82 | +- Start small: Pick a test file with just a few instances to convert |
| 83 | +- Run the test suite after your changes to ensure nothing breaks |
| 84 | +- Follow Git's commit message style |
| 85 | +- Include which command you used to find the instances in your commit message |
| 86 | + |
| 87 | +#### Need Help? |
| 88 | +- Reference [this discussion](https://public-inbox.org/git/CAPig+cRfO8t1tdCL6MB4b9XopF3HkZ==hU83AFZ38b-2zsXDjQ@mail.gmail.com/) |
| 89 | + for detailed examples. |
| 90 | +- If you can't find any instances to fix, let us know what search command you |
| 91 | + used |
| 92 | + |
| 93 | + |
| 94 | +### Add more builtin patterns for userdiff |
| 95 | + |
| 96 | +"git diff" shows the function name corresponding to each hunk after |
| 97 | +the @@ ... @@ line. For common languages (C, HTML, Ada, Matlab, ...), |
| 98 | +the way to find the function name is built-in Git's source code as |
| 99 | +regular expressions (see userdiff.c). A few languages are common |
| 100 | +enough to deserve a built-in driver, but are not yet recognized. For |
| 101 | +example, shell. |
| 102 | + |
| 103 | +This project requires a very good knowledge of regular expressions. |
| 104 | + |
| 105 | +It is easy though to find examples of how this can be done by |
| 106 | +searching the code base and the mailing list archive, as this has |
| 107 | +already been done for a number of languages. |
| 108 | + |
| 109 | +### Replace a run_command*() call by direct calls to C functions |
| 110 | + |
| 111 | +See for example what Junio did in |
| 112 | +[ffcb4e94d3](https://github.com/git/git/commit/ffcb4e94d3) (bisect: do |
| 113 | +not run show-branch just to show the current commit, 2021-07-27). |
| 114 | + |
| 115 | +If you can't find one please tell us, along with the command you used |
| 116 | +to search, so that we can remove this microproject idea. |
| 117 | + |
| 118 | +### Avoid suppressing `git`'s exit code in test scripts |
| 119 | + |
| 120 | +The Git project uses a large collection of integration tests written in |
| 121 | +Shell to guard against regressions when adding new features or fixing |
| 122 | +bugs. The scripts in question can be found in the `t` directory |
| 123 | +[here][git-t]. |
| 124 | + |
| 125 | +While it is perfectly OK to use [pipes][wikipedia-pipes] when writing |
| 126 | +integration tests, we must be careful to avoid writing a pipeline that |
| 127 | +suppresses the exit code of a Git process, like so: |
| 128 | + |
| 129 | +``` |
| 130 | +git <subcommand> | <some other command> |
| 131 | +``` |
| 132 | + |
| 133 | +...since the exit code of `git <subcommand>` would be suppressed by the |
| 134 | +pipe. If `git <subcommand>` crashed, we would not catch it in the above |
| 135 | +example when running the integration suite. |
| 136 | + |
| 137 | +Other examples to avoid include: |
| 138 | + |
| 139 | +``` |
| 140 | +# bad: |
| 141 | +<some command> $(git <subcommand>) |
| 142 | +
|
| 143 | +# also bad: |
| 144 | +<some command> <<EOF |
| 145 | +... some text ... |
| 146 | +$(git <subcommand>) |
| 147 | +EOF |
| 148 | +``` |
| 149 | + |
| 150 | +...since the exit code of `git <subcommand>` is hidden behind the |
| 151 | +subshell in both instances. |
| 152 | + |
| 153 | +On the other hand, both of the following examples are OK, since neither |
| 154 | +hides the exit code of running `git <subcommand>`: |
| 155 | + |
| 156 | +``` |
| 157 | +# good: |
| 158 | +var=$(git <subcommand>) |
| 159 | +
|
| 160 | +# also good: |
| 161 | +<some command> | <some other command> | git <subcommand> |
| 162 | +``` |
| 163 | + |
| 164 | +(provided that neither `<some command>` or `<some other command>` are |
| 165 | +`git`). |
| 166 | + |
| 167 | +See the commit |
| 168 | +[c6f44e1da5](https://github.com/git/git/commit/c6f44e1da5e88e34) |
| 169 | +for example, and then do the same thing in one other test script. |
| 170 | + |
| 171 | +If you can't find one please tell us, along with the command you used |
| 172 | +to search, so that we can remove this microproject idea. |
| 173 | + |
| 174 | +[git-t]: https://github.com/git/git/tree/master/t |
| 175 | +[wikipedia-pipes]: https://en.wikipedia.org/wiki/Pipeline_(Unix) |
| 176 | + |
| 177 | +### Use unsigned integral type for collection of bits. |
| 178 | + |
| 179 | +Pick one field of a structure that (1) is of signed integral type and (2) is |
| 180 | +used as a collection of multiple bits. Discuss if there is a good reason |
| 181 | +why it has to be a signed integral field and change it to an unsigned |
| 182 | +type otherwise. [[thread ](https://public-inbox.org/git/[email protected])] |
| 183 | + |
| 184 | +Even though the amount of code to write is small, these projects |
| 185 | +involve a lot of prior work to understand the specification and deal |
| 186 | +with all potential corner-cases. |
| 187 | + |
| 188 | +### Modernize a test script |
| 189 | + |
| 190 | +A number of our test scripts have been written a long time ago in a |
| 191 | +style that is now outdated. |
| 192 | + |
| 193 | +In the following email it is explained in details how to modernize and |
| 194 | +clean up the t7001 test script: |
| 195 | + |
| 196 | +<https://lore.kernel.org/git/CAPig+cQpUu2UO-+jWn1nTaDykWnxwuEitzVB7PnW2SS_b7V8Hg@mail.gmail.com/> |
| 197 | + |
| 198 | +t7001 is not the only test script where similar changes could be made |
| 199 | +though. |
| 200 | + |
| 201 | +Find one test script that needs some of the same changes and make |
| 202 | +them. Please make sure that the test script is not already being |
| 203 | +worked on by asking on the mailing list before starting to work on it. |
| 204 | + |
| 205 | +There should be only one kind of change per commit. For example if one |
| 206 | +of your commits indents test bodies with TABs, instead of spaces, then |
| 207 | +this should be the only kind of change in this commit. |
| 208 | + |
0 commit comments