<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/105762>105762</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Darker diffs should be apply-able, or command should autofix
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            infrastructure
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          keith
      </td>
    </tr>
</table>

<pre>
    I got this great python formatter comment on my PR:

https://github.com/llvm/llvm-project/pull/105759#issuecomment-2305991211

copied content in case it gets deleted:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r 09a275e8a4c2cea22bb67c7247fc892d5e73eb42...09671451af93ebe468971bc3e3b9882d09b7f354 llvm/utils/lit/lit/TestRunner.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- TestRunner.py       2024-08-23 00:57:43.000000 +0000
+++ TestRunner.py       2024-08-23 01:04:52.524386 +0000
@@ -1222,12 +1222,14 @@
                     commands[i] += f" && {{ {command}; }}"
 if test.config.pipefail:
             f.write(b"set -o pipefail;" if mode == "wb" else "set -o pipefail;")
         f.write(b"set -x;" if mode == "wb" else "set -x;")
 
-        env_str = "\n".join("export {}={};".format(k, shlex.quote(v))
- for k, v in test.config.environment.items())
+        env_str = "\n".join(
+            "export {}={};".format(k, shlex.quote(v))
+            for k, v in test.config.environment.items()
+        )
 f.write(bytes(env_str, "utf-8") if mode == "wb" else env_str)
 
 if sys.version_info > (3, 0) and mode == "wb":
 f.write(bytes("{ " + "; } &&\n{ ".join(commands) + "; }", "utf-8"))
         else:

``````````

</details>

But neither this command or diff are exactly what I was hoping for. I was hoping that either the darker command could be updated to just apply the diff, which it doesn't seem like it can:

```
darker 09a275e8a4c2cea22bb67c7247fc892d5e73eb42...09671451af93ebe468971bc3e3b9882d09b7f354 llvm/utils/lit/lit/TestRunner.py
argument PATH: Error: Path(s) '09a275e8a4c2cea22bb67c7247fc892d5e73eb42...09671451af93ebe468971bc3e3b9882d09b7f354' do not exist in the working tree
```

Or I'd be able to copy and paste the diff contents and run `git apply` which I cannot because the path is not `TestRunner.py`, so git is expecting it to be `llvm/utils/lit/lit/TestRunner.py`. If I manually update the paths in the diff to be:

```
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
```

Then applying it works, but I think it would be nice if either of these options worked without this extra step
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV11v4zoO_TXKC2HDpr_ihzw0TYMtcGdnMCgusE8Xsk3HmjqSV5Kb5N8vJDtJm-kdtNhZbGDYrS0dkueIFMWNETtJtGLZmmWbBR9tp_TqmYTtFpVqTqtH2CkLthMGdpq4heFkOyWhVXrPrSUNtdrvSVpQEvYn-PadJXcs2rBovnfWDsa9wy3D7U7YbqzCWu0Zbvv-5fwIBq1-UG0Zboex7xlu4ygrspJhIowZaTYSYBJlZRljHL-2UatBUAO1ktZ5IiTU3BAICzuyBhrqyVJz4xhL7hnGQfDHH39-gfuvmwfYfv3-5e4J7r9--fLwzyeW3AEr1g3Xz6RZsQkCljy8AZhh7g5cSyF3bsK3iZ1aNXSliOE9TDDQqlE24EMyzs-TGrUfHcIboBtHG7Jc9ObqQHJvxv2e69Pl1b_UCDWXYMnMevWq5n1_goOwHdjOOdT36iDkzmvG5StGHBfbW8j5nke_uCpuumncHGEQ1B3VzxAEjWhbCDREJccioyVPa6yJI1ZVXtQFpkVbL0tsMioSqlIMwzAq8yJOs5i3ZUIVpfmyLOKqTiipyuUSm6isijbJUpiXzmgdK7jthb3cn8jY76OUpMPh9JEQfloU25_o_oQOfwo6eLZ9-K1W-7P2HWkK_1u-Heo0LggCuIm1xAjTIFoGmEAUseQuK1hylyZh5H_AcO2esx1cT9cvUWKW3EWpg8IwwzRZ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