So I'm currently setting up a git pre-commit hook to lint my python files with iSort, and python Black, the issue I'm running into is that when I use git commit --verbose
the diff that shows up in the commit editor hasn't actually taken the modifications to the staged files into account.
For example, lets say I have a python file that looks like so:
import re
from os import path
def x():
v = re.compile(r"1")
print(3, v)
def y(v=3):
z = path.join("a", "b")
thing = "a string"
print(thing, z)
Based on the iSort and black settings I have configured, my pre-commit script will change the file to look like so:
import re
from os import path
def x():
v = re.compile(r"1")
print(3, v)
def y(v=3):
z = path.join("a", "b")
thing = "a string"
print(thing, z)
Unfortunately in the git commit editor it still shows the non modified diff. Is there some way to get the editor to have the correct output?
Theoretically I guess it doesn't matter, but it would be nice to see what the diff would actually be.