msysgit / git

msysGit-based Git for Windows 1.x is now superseded by Git for Windows 2.x
http://github.com/git-for-windows/git
Other
1.01k stars 317 forks source link

Git Blame - file.dot is not a Word Document #367

Closed Choonster closed 9 years ago

Choonster commented 9 years ago

Git Version: 1.9.5.msysgit.0 OS: MINGW32_NT-6.2 (Git Bash on Windows 8.1 with MS Word 2013 installed)

Steps to reproduce:

git clone https://github.com/torvalds/linux.git
cd linux
git blame Documentation/blockdev/drbd/conn-states-8.dot

Output from git blame:

Documentation/blockdev/drbd/conn-states-8.dot is not a Word Document.
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  1) digraph conn_states {
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  2)         StandAllone  ->
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  3)         WFConnection ->
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  4)         WFConnection ->
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  5)         WFReportParams -
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  6)         WFReportParams -
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  7)         WFReportParams -
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  8)         WFReportParams -
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700  9)         WFBitMapS -> Syn
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 10)         WFBitMapT -> Syn
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 11)         SyncSource -> Co
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 12)         SyncTarget -> Co
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 13)         SyncSource -> Pa
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 14)         SyncTarget -> Pa
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 15)         PausedSyncS -> S
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 16)         PausedSyncT -> S
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 17)         Connected   -> W
b411b363 (Philipp Reisner 2009-09-25 16:07:19 -0700 18) }

It seems like Git is trying and failing to open the .dot file with Word, but opening it with Word directly works without issue.

dscho commented 9 years ago

It seems like Git is trying and failing to open the .dot file with Word, but opening it with Word directly works without issue.

Umm. What you have there is not a Word document at all. It is a GraphViz file.

Our global gitattributes file says that the Word helper should be used to visualize the file contents, hence the warning (which you could silence by creating a file .git/info/attributes inside your project's top-level directory with the line *.dot -astextplain).

But since Git falls back to treating the .dot file as plain text, I do not see that there is a real problem. After all, the correct output is shown, wouldn't you agree?

Please also note that we do appreciate it everytime a user asks questions on the mailing list instead of opening a ticket in our bug tracker where we really would like only reports of problems caused by the software.

Choonster commented 9 years ago

I thought this was an issue/bug with Git or Git for Windows, hence the ticket rather than the question.

I realise that it's a GraphViz file rather than a Word document, but I wasn't aware that the error message was coming from Git's Word helper.

I encountered this behaviour through a third-party tool that reads the output of git blame and treats the message on stderr as an error. I'm not sure what the correct behaviour would be here, since the Word helper expects .dot files to be Word documents and warns when they're not and third-party tools usually expect messages on stderr to be errors.

Adding an attributes file with *.dot diff=-astextplain did silence the warning, though.

dscho commented 9 years ago

Adding an attributes file with *.dot diff=-astextplain did silence the warning

That is the correct solution. Git for Windows expects .dot files to be Word files by default, and you overrode the default. :+1: