Broken textconf for git diff #14769

Closed
opened 2025-11-02 11:22:33 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Langenfeld on GitHub (Jul 17, 2025).

Description

Custom diff for binary formats (docx, pdf, doc) via git textconf is not working anymore since gitea 1.24 (worked fine on 1.23). Instead of text content of the files, now some unicode gibberish is shown (see screenshot).

part of app.ini:

[git.config]
core.attributesfile = <GITEADATA>/home/.gitattributes
diff.pandoc.textconv =pandoc --to=markdown --wrap=none
diff.pandoc.binary=true
diff.pandoc.prompt =false
diff.catdoc.textconv =catdoc
diff.catdoc.binary=true
diff.pdftotext.textconv =sh -c 'pdftotext -layout -enc UTF-8 "$0" -'
diff.pdftotext.binary=true

.gitattributes

*.docx diff=pandoc
*.doc diff=catdoc
*.pdf diff=pdftotext

the call gitea uses to run the textconf looks somehow wired, as (e.g. for pandoc) the textconf command shows up twice:
/bin/sh -c pandoc --to=markdown --wrap=none "$@" pandoc --to=markdown --wrap=none theDoc.docx
The textconf command runs fine on console and produces the intended output.

Gitea Version

1.24.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

Git Version

2.39.5

Operating System

Debian 12

How are you running Gitea?

running from systemd with prebuild version from gitea.io

Database

MySQL/MariaDB

Originally created by @Langenfeld on GitHub (Jul 17, 2025). ### Description Custom diff for binary formats (docx, pdf, doc) via git ``textconf`` is not working anymore since gitea 1.24 (worked fine on 1.23). Instead of text content of the files, now some unicode gibberish is shown (see screenshot). part of app.ini: ``` [git.config] core.attributesfile = <GITEADATA>/home/.gitattributes diff.pandoc.textconv =pandoc --to=markdown --wrap=none diff.pandoc.binary=true diff.pandoc.prompt =false diff.catdoc.textconv =catdoc diff.catdoc.binary=true diff.pdftotext.textconv =sh -c 'pdftotext -layout -enc UTF-8 "$0" -' diff.pdftotext.binary=true ``` .gitattributes ``` *.docx diff=pandoc *.doc diff=catdoc *.pdf diff=pdftotext ``` the call gitea uses to run the textconf looks somehow wired, as (e.g. for pandoc) the textconf command shows up twice: ``/bin/sh -c pandoc --to=markdown --wrap=none "$@" pandoc --to=markdown --wrap=none theDoc.docx`` The textconf command runs fine on console and produces the intended output. ### Gitea Version 1.24.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots <img width="1127" height="211" alt="Image" src="https://github.com/user-attachments/assets/097a0659-8b1e-4f04-a3dc-91257b71fd8f" /> ### Git Version 2.39.5 ### Operating System Debian 12 ### How are you running Gitea? running from systemd with prebuild version from gitea.io ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 11:22:33 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jul 17, 2025):

I think it is related to Full-file syntax highlighting for diff pages #33766

@dfirebaugh do you have some ideas?

@wxiaoguang commented on GitHub (Jul 17, 2025): I think it is related to Full-file syntax highlighting for diff pages #33766 @dfirebaugh do you have some ideas?
Author
Owner

@wxiaoguang commented on GitHub (Jul 18, 2025):

Are you able to build your own binary? If yes, could you try this fix? Don't use full-file highlight when there is a git diff textconv #35114

Update: or you can wait for the nightly build.

The idea is that: if diff attribute exists in .gitattributes, then do not use the newly introduced "full file highlight" approach.

@wxiaoguang commented on GitHub (Jul 18, 2025): Are you able to build your own binary? If yes, could you try this fix? Don't use full-file highlight when there is a git diff textconv #35114 Update: or you can wait for the nightly build. The idea is that: if `diff` attribute exists in `.gitattributes`, then do not use the newly introduced "full file highlight" approach.
Author
Owner

@wxiaoguang commented on GitHub (Jul 18, 2025):

The nightly build is ready, could you try it?

@wxiaoguang commented on GitHub (Jul 18, 2025): The nightly build is ready, could you try it? * https://dl.gitea.com/gitea/main-nightly/ * https://hub.docker.com/r/gitea/gitea/tags?name=nightly
Author
Owner

@wxiaoguang commented on GitHub (Jul 18, 2025):

And 1.24 nightly (will be 1.24.4 soon), it is a stable release, and contains the fix:

@wxiaoguang commented on GitHub (Jul 18, 2025): And 1.24 nightly (will be 1.24.4 soon), it is a stable release, and contains the fix: * https://dl.gitea.com/gitea/1.24-nightly/ * https://hub.docker.com/r/gitea/gitea/tags?name=1.24-nightly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14769