threads / discuss / 31933

git-gui: textconv not used on unstaged files

Subject: git-gui: textconv not used on unstaged files

## tl;dr

4 messages between Oct 24, 2012 and Nov 27, 2012.

replies: 3people: 2as markdown or json

Peter Oberndorfer· Oct 24, 2012, 18:33 UTC · lore
Hi,

i am using a textconv filter to display .doc files as plain text. It seems git gui does not use this textconv filter for displaying new unstaged files (other files? = _O) It seems diff.tcl start_show_diff calls show_other_diff because of this. This manually loads the file and does not care about textconv filters.

Is this manual loading really necessary or can't we just ask git? If it is can it be modified to use the textconv filter?

Thanks, Greetings Peter

.gitattributes: *.doc diff=astextplain

gitconfig:
[diff "astextplain"]
     textconv = astextplain
Peter Oberndorfer· Nov 26, 2012, 20:28 UTC · re: Peter Oberndorfer · lore

Re: git-gui: textconv not used on unstaged files

On 2012-10-24 20:33, Peter Oberndorfer wrote:
Show 11 quoted lines
> Hi,
>
> i am using a textconv filter to display .doc files as plain text.
> It seems git gui does not use this textconv filter for displaying new unstaged files
> (other files? = _O)
> It seems diff.tcl start_show_diff calls show_other_diff because of this.
> This manually loads the file and does not care about textconv filters.
>
> Is this manual loading really necessary or can't we just ask git?
> If it is can it be modified to use the textconv filter?
>

Does anybody have a idea which git command would output the diff of a untracked file against /dev/null? So I can show the textconved version of the file in git gui. (and not reinvent the code to apply textconv already in git)

Thanks, Greetings Peter

Show 7 quoted lines
>
> .gitattributes:
> *.doc    diff=astextplain
>
> gitconfig:
> [diff "astextplain"]
>     textconv = astextplain
Junio C Hamano· Nov 26, 2012, 20:54 UTC · re: Peter Oberndorfer · lore

Re: git-gui: textconv not used on unstaged files

Peter Oberndorfer <kumbayo84@arcor.de> writes:
> Does anybody have a idea which git command would output the diff
> of a untracked file against /dev/null?

The "--no-index" option is meant as a bolt-on to let you use various features of "git diff" that is missing from other people's "diff" in a context where git does not know anything about that file. It should be usable even outside a git repository.

    $ git diff --no-index /dev/null new-file.txt

I do not know offhand (and didn't bother to check) if textconv applies, though. It does need access to a git repository as it reads from the $GIT_DIR/config to learn what to do.

Peter Oberndorfer· Nov 27, 2012, 20:37 UTC · re: Junio C Hamano · lore

Re: git-gui: textconv not used on unstaged files

On 2012-11-26 21:54, Junio C Hamano wrote:
Show 14 quoted lines
> Peter Oberndorfer <kumbayo84@arcor.de> writes:
>
>> Does anybody have a idea which git command would output the diff
>> of a untracked file against /dev/null?
> The "--no-index" option is meant as a bolt-on to let you use various
> features of "git diff" that is missing from other people's "diff" in
> a context where git does not know anything about that file.  It
> should be usable even outside a git repository.
>
>     $ git diff --no-index /dev/null new-file.txt
>
> I do not know offhand (and didn't bother to check) if textconv
> applies, though.  It does need access to a git repository as it
> reads from the $GIT_DIR/config to learn what to do.
Hi,

this seems to work when adding the --textconv option. I will try to see if I can modify git gui to use this command when clicking a unstaged file.

Thanks, Greetings Peter

← back to recent threads