[proposal] Custom git diff rendering for binary files #12288
Labels
topic/content-rendering
Changes how certain filetypes are displayed
type/proposal
The new feature has not been accepted yet but needs to be discussed first.
Currently gitea only shows git diffs for text files, and can't for binary files.
git diff
has native support for custom drivers for converting binary files to text in order to display a diff.Since gitea just runs the
git diff
command and parsesstdout
we can leverage thisgitea/services/gitdiff/gitdiff.go
Line 717 in 9542b73
By customising
git config --global --edit
and adding:Which is equivalent to running:
And then creating the file
/root/gitea/custom/git/.gitattributes
with contents:*.docx diff=pandoc
We get a much better outpjut:
The proposal
I propse that we allow users to implement this in an easier way, this could be done in a number of ways.
git config --global
file - default location being/root/.gitconfig
$GITEA_CUSTOM/git/config
and allowing the user to configure that as they pleaseapp.ini
called something like [git.config] and allow the user to build a git config from the entries there - this may require translation between.ini
syntax and whatever syntaxgit config
usesCUSTOM_DIFF
andTEXTCONV_DIFF_COMMAND
and use that to autopopulate/root/.gitconfig
and a.gitattributes
fileNote
1.a
and1.b
generailse to allow the user to configure all of the git config options,2
is specific to the rendering of diffsThe text was updated successfully, but these errors were encountered: