On Fri, Sep 12, 2025 at 6:14 AM Guo Tingsheng <CoriCraft16@xxxxxxxxxxx> wrote: > > Hello Git developers, > > I would like to report a potential formatting issue I encountered when testing Git merges. > > Environment: > - git version: 2.43.0 > - OS: Ubuntu 24.04 LTS > > Steps to reproduce: > 1. Start from a commit containing the following method: > > public void process() { > if (flag) { > execute(); > } > } > > 2. On branch A, modify the code by adding a new conditional block with indentation consistent with the surrounding style: > > public void process() { > if (flag) { > execute(); > } > if (shouldLog) { > logger.log("Action executed."); > } > } > > 3. On branch B, make no changes to this function. > > 4. Merge branch A and branch B using: > git merge A > > Expected result: > - The merged file should retain the indentation style introduced by branch A: > > public void process() { > if (flag) { > execute(); > } > if (shouldLog) { > logger.log("Action executed."); > } > } > > Actual result: > - Git reduces the indentation of the newly added lines, producing inconsistent formatting: > > public void process() { > if (flag) { > execute(); > } > if (shouldLog) { > logger.log("Action executed."); > } > } > > Additional information: > - This issue appears to occur non-deterministically across different test cases. > - It does not seem related to core.whitespace or space-change options, but instead to how Git decides indentation for newly introduced blocks. > - The problem was reproduced using multiple merge strategies (ort, recursive). I've never seen or heard of such a thing before; can you create a testcase to reproduce it, either a repository that others can clone together with the commands to trigger it, or a bunch of commands to both create a simple repository and demonstrate the issue?