My commit-message assistant described additions as deletions
My commit-message assistant described added code as though I had removed it. Before changing the prompt, I needed to check the diff I was sending to the model.
The March 13 fix changes the GitPython call:
-diff_index = repo.index.diff(other, create_patch=True)
+diff_index = repo.index.diff(other, create_patch=True, R=True)
The same commit loads dotenv configuration, but that is a separate change. This line fixes the direction of the patch.
Use a change small enough to recognize
For a teaching fixture, start with a three-line file:
first
middle
last
Change the middle line to new middle and stage the file. The description I expect is that middle was replaced by new middle.
With the old call comparing the index to HEAD, the patch has the opposite direction:
@@ -1,3 +1,3 @@
first
-new middle
+middle
last
That input tells a reader to remove the new text and put the original back. A model describing it that way would be following the supplied patch.

A separate Wikipedia revision comparison by HNordeen (WMF), CC0. It illustrates a comparison interface, not the Git patch above.
Reverse the comparison
For the staged-change comparison, R=True produces:
@@ -1,3 +1,3 @@
first
-middle
+new middle
last
That matches the direction shown by git diff --cached for this fixture.
The important distinction is between the working file, the staged index, and the last commit. I want the proposed commit’s change from HEAD to the index. Merely passing those two objects to a library method doesn’t guarantee I selected that order.
This is why the fixture is useful. I can recognize the expected patch without asking another model to judge it. Comparing the wrapper output with Git’s own staged diff tests the input boundary directly.
The output model couldn’t catch this
In the structured-output post, I gave the response a title and body. Both can be valid strings while describing the wrong change.
The offline application tests can also pass their own checks if they only look for a message or a successful command. To catch this defect, a test needs to inspect the meaning of the patch direction: which known line is added and which is removed.
I needed to correct the direction of the diff before judging the message the model wrote about it.