Ulrich Windl wrote that in Git 2.51.0, git diff did not show the name of the shell function containing a change. He acknowledged that his script used an uncommon line-breaking style, with a backslash continuation inside a function body.
Johannes Sixt answered that, as far as he remembers, Git does not activate diff drivers automatically for any type of file. All driver-specific properties are therefore ignored unless the user enables one.
He suggested adding a line such as "*.sh diff=bash" to .git/info/attributes or a .gitattributes file. Without that, the default hunk header pattern is used. It picks up lines that begin with a non-punctuation character.
The excerpts do not show whether the bash driver then handles Windl's multi-line declaration correctly.