{"thread":{"id":"31185","subject":"File path not escaped in warning message","startedAt":"2012-08-04T12:55:17Z","lastAt":"2012-08-07T08:20:23Z","messageCount":7,"participants":["Janusz Białobrzewski","Junio C Hamano","jbialobr","karsten.blees@dcon.de"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"196457","messageId":"501D1BB5.6020200@o2.pl","threadId":"31185","inReplyTo":null,"subject":"File path not escaped in warning message","fromName":"Janusz Białobrzewski","fromEmail":"jbialobr@o2.pl","sentAt":"2012-08-04T12:55:17Z","receivedAt":"2012-08-04T12:55:17Z","isPatch":false,"sender":{"key":"jbialobr@o2.pl","avatar":"https://gravatar.com/avatar/582fa36441bf789976d4b7bbf3a79635270c4c7349db3eaac2142657f1ea85e5?d=mp&s=160"},"body":"Hi,\n\nI have enabled core.quotepath, but file path in warning isn't escaped:\nFile name is 1ą.txt its content is encoded in windows-1250\nOutput of git diff after reencoding to windows1250 is:\n\nwarning: LF will be replaced by CRLF in 1Ä….txt.\nThe file will have its original line endings in your working directory.\n\nBut I expected it to be:\n\nwarning: LF will be replaced by CRLF in 1\\304\\205.txt.\nThe file will have its original line endings in your working directory.\n\nBest regards,\nJanusz Białobrzewski.\n"},{"id":"196474","messageId":"7v39429u58.fsf@alter.siamese.dyndns.org","threadId":"31185","inReplyTo":"501D1BB5.6020200@o2.pl","subject":"Re: File path not escaped in warning message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-04T22:20:19Z","receivedAt":"2012-08-04T22:20:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Janusz Białobrzewski <jbialobr@o2.pl> writes:\n\n> I have enabled core.quotepath, but file path in warning isn't escaped:\n> File name is 1ą.txt its content is encoded in windows-1250\n> Output of git diff after reencoding to windows1250 is:\n>\n> warning: LF will be replaced by CRLF in 1Ä….txt.\n> The file will have its original line endings in your working directory.\n>\n> But I expected it to be:\n>\n> warning: LF will be replaced by CRLF in 1\\304\\205.txt.\n> The file will have its original line endings in your working directory.\n\nDo msysgit folks want to look into this, perhaps?\n\nThanks.\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"196486","messageId":"501E616E.6000907@o2.pl","threadId":"31185","inReplyTo":"7v39429u58.fsf@alter.siamese.dyndns.org","subject":"Re: File path not escaped in warning message","fromName":"Janusz Białobrzewski","fromEmail":"jbialobr@o2.pl","sentAt":"2012-08-05T12:05:02Z","receivedAt":"2012-08-05T12:05:02Z","isPatch":false,"sender":{"key":"jbialobr@o2.pl","avatar":"https://gravatar.com/avatar/582fa36441bf789976d4b7bbf3a79635270c4c7349db3eaac2142657f1ea85e5?d=mp&s=160"},"body":"Here is output from linux:\n\n[janusz@mikrus JavaCommon]$ git config --add core.quotepath false\n[janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\nwarning: LF will be replaced by CRLF in 1<B1>.txt.\nThe file will have its original line endings in your working directory.\ndiff --git a/1<B1>.txt b/1<B1>.txt\nindex 281ad6f..9444a66 100644\n--- a/1<B1>.txt\n+++ b/1<B1>.txt\n@@ -1,2 +1,2 @@\n aaaa\n-bbb\n+bbbc\n\n\n[janusz@mikrus JavaCommon]$ git config --unset core.quotepath\n[janusz@mikrus JavaCommon]$ git config --add core.quotepath true\n[janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\nwarning: LF will be replaced by CRLF in 1<B1>.txt.\nThe file will have its original line endings in your working directory.\ndiff --git \"a/1\\261.txt\" \"b/1\\261.txt\"\nindex 281ad6f..9444a66 100644\n--- \"a/1\\261.txt\"\n+++ \"b/1\\261.txt\"\n@@ -1,2 +1,2 @@\n aaaa\n-bbb\n+bbbc\n\nJanusz Białobrzewski.\n\nJunio C Hamano pisze:\n> Janusz Białobrzewski <jbialobr@o2.pl> writes:\n>\n>   \n>> I have enabled core.quotepath, but file path in warning isn't escaped:\n>> File name is 1ą.txt its content is encoded in windows-1250\n>> Output of git diff after reencoding to windows1250 is:\n>>\n>> warning: LF will be replaced by CRLF in 1Ä….txt.\n>> The file will have its original line endings in your working directory.\n>>\n>> But I expected it to be:\n>>\n>> warning: LF will be replaced by CRLF in 1\\304\\205.txt.\n>> The file will have its original line endings in your working directory.\n>>     \n>\n> Do msysgit folks want to look into this, perhaps?\n>\n> Thanks.\n>\n>   \n"},{"id":"196497","messageId":"7v1ujl3ysi.fsf@alter.siamese.dyndns.org","threadId":"31185","inReplyTo":"501E616E.6000907@o2.pl","subject":"Re: File path not escaped in warning message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-05T19:48:45Z","receivedAt":"2012-08-05T19:48:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Janusz Białobrzewski <jbialobr@o2.pl> writes:\n\n> Here is output from linux:\n>\n> [janusz@mikrus JavaCommon]$ git config --add core.quotepath false\n> [janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\n> warning: LF will be replaced by CRLF in 1<B1>.txt.\n> The file will have its original line endings in your working directory.\n\nI do not know offhand if the literal <B1> is the byte value you want\nor not, but core.quotepath should not affect it.\n\nThe configuration is primarily about quoting paths that appear in\nthe header part in the diff output for machine readability.  In this\noutput,\n\n> diff --git a/1<B1>.txt b/1<B1>.txt\n> index 281ad6f..9444a66 100644\n> --- a/1<B1>.txt\n> +++ b/1<B1>.txt\n\nthe paths are not quoted because quotepath is set to false, but in\nthe next example, it\n\n> ...\n> [janusz@mikrus JavaCommon]$ git config --unset core.quotepath\n> [janusz@mikrus JavaCommon]$ git config --add core.quotepath true\n> [janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\n> warning: LF will be replaced by CRLF in 1<B1>.txt.\n> The file will have its original line endings in your working directory.\n> diff --git \"a/1\\261.txt\" \"b/1\\261.txt\"\n> index 281ad6f..9444a66 100644\n> --- \"a/1\\261.txt\"\n> +++ \"b/1\\261.txt\"\n\nis quoted due to the configuration setting.\n\nAgain, <B1> in the warning message is not affected, as the quotepath\nconfiguration is not meant to affect messages that are meant for\nhuman consumption.\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"196536","messageId":"2783325c.512962ce.501f69dd.5711e@o2.pl","threadId":"31185","inReplyTo":"7v1ujl3ysi.fsf@alter.siamese.dyndns.org","subject":"Re: Re: File path not escaped in warning message","fromName":"jbialobr","fromEmail":"jbialobr@o2.pl","sentAt":"2012-08-06T06:53:17Z","receivedAt":"2012-08-06T06:53:17Z","isPatch":false,"sender":{"key":"jbialobr@o2.pl","avatar":"https://gravatar.com/avatar/582fa36441bf789976d4b7bbf3a79635270c4c7349db3eaac2142657f1ea85e5?d=mp&s=160"},"body":"There is nothing said in the manual, that core.quotepath affects only header. But it is not the point. You don't know which part of git output will be consumed by machine. Warning message is addressed to human, but it can be consumed by program in the same way as all other messages and output data.\nImho, since warning comes from git, path should be quoted to\nmake git behaviour consistent. \nFrom git-log help:\n> Note that we deliberately chose not to re-code the commit log message when a commit is made to force UTF-8 at the commit object level, because re-coding to UTF-8 is not necessarily a reversible operation.\n\nIf re-coding from one encoding to other is not necessarily a reversible operation, and you can set logoutputencoding to any encoding you wish, you may loose some charatcers while recoding file path in warning message. Quoting it would be desired then.\n\nJanusz Białobrzewski.\n\n---- Wiadomość Oryginalna ----\nOd: Junio C Hamano <gitster@pobox.com>\nDo: Janusz Białobrzewski <jbialobr@o2.pl>\nKopia do: msysgit@googlegroups.com,  git@vger.kernel.org\nData: 5 sierpnia 2012 21:48\nTemat: Re: File path not escaped in warning message\n\n> Janusz Białobrzewski <jbialobr@o2.pl> writes:\n> \n> > Here is output from linux:\n> >\n> > [janusz@mikrus JavaCommon]$ git config --add core.quotepath false\n> > [janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\n> > warning: LF will be replaced by CRLF in 1<B1>.txt.\n> > The file will have its original line endings in your working directory.\n> \n> I do not know offhand if the literal <B1> is the byte value you want\n> or not, but core.quotepath should not affect it.\n> \n> The configuration is primarily about quoting paths that appear in\n> the header part in the diff output for machine readability.  In this\n> output,\n> \n> > diff --git a/1<B1>.txt b/1<B1>.txt\n> > index 281ad6f..9444a66 100644\n> > --- a/1<B1>.txt\n> > +++ b/1<B1>.txt\n> \n> the paths are not quoted because quotepath is set to false, but in\n> the next example, it\n> \n> > ...\n> > [janusz@mikrus JavaCommon]$ git config --unset core.quotepath\n> > [janusz@mikrus JavaCommon]$ git config --add core.quotepath true\n> > [janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\n> > warning: LF will be replaced by CRLF in 1<B1>.txt.\n> > The file will have its original line endings in your working directory.\n> > diff --git \"a/1\\261.txt\" \"b/1\\261.txt\"\n> > index 281ad6f..9444a66 100644\n> > --- \"a/1\\261.txt\"\n> > +++ \"b/1\\261.txt\"\n> \n> is quoted due to the configuration setting.\n> \n> Again, <B1> in the warning message is not affected, as the quotepath\n> configuration is not meant to affect messages that are meant for\n> human consumption.\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"196549","messageId":"OF9C260C14.7F8DC09D-ONC1257A52.005D3AD5-C1257A52.005F222E@dcon.de","threadId":"31185","inReplyTo":"2783325c.512962ce.501f69dd.5711e@o2.pl","subject":"Re: Re: Re: File path not escaped in warning message","fromName":"","fromEmail":"karsten.blees@dcon.de","sentAt":"2012-08-06T17:18:58Z","receivedAt":"2012-08-06T17:18:58Z","isPatch":false,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Hi Janusz,\n\nIt seems you're mixing up a few completely unrelated concepts here.\n\nCore.quotepath enables quoting and escaping of special characters in file \nnames. This has nothing to do with character set encoding of file names \n(i.e. Cp1250/ISO-8859-2/UTF-8). AFAIK, apart from git-svn, git currently \ndoesn't support character set re-coding of file names at all, so \ncore.quotepath and encoding are completely unrelated.\n\nRegarding git-log / git-diff output, there are basically three different \ncharacter set encodings involved:\n1. commit log messages: re-coded to i18n.logoutputencoding (usually UTF-8)\n2. file content: printed verbatim (no re-coding); gui tools such as gitk \nmay decode this based on gui.encoding or .gitattributes settings\n3. everything else (file names, diff headers, error / warning messages): \nalways UTF-8 (at least in Git for Windows)\n\nGui tools such as gitk decode this output line by line using the \nappropriate encoding.\n\n\n<jbialobr@o2.pl> wrote on 06.08.2012 08:53:17:\n> File name is 1ą.txt its content is encoded in windows-1250\n\nFile name encoding and file content encoding are completely unrelated. \nFile name encoding in current Git for Windows is *always* UTF-8, file \ncontent encoding can be anything.\n\n> Output of git diff after reencoding to windows1250 is:\n>\n> warning: LF will be replaced by CRLF in 1Ä….txt.\n> The file will have its original line endings in your working directory.\n\nThis looks like the file name is UTF-8, but reinterpreted (not reencoded) \nas if it were Cp1250. However, as stated above, you cannot simply \ninterpret the entire git-log / git-diff output as beeing one particular \nencoding, as the encoding may vary on a line by line basis.\n\n> Here is output from linux:\n>\n> [janusz@mikrus JavaCommon]$ git config --add core.quotepath false\n> [janusz@mikrus JavaCommon]$ git diff  --unified=3 -- \"1ą.txt\"\n> warning: LF will be replaced by CRLF in 1<B1>.txt.\n> The file will have its original line endings in your working directory.\n\n\"<B1>\" looks like less's escaping with missing LESSCHARSET setting.\n\nAdditionally, your Linux box seems to be set up with ISO-8859-2 system \nencoding. Git repositories created on this system will not be portable, \ni.e. using the same repository on other Linux systems, Git for Windows, \nCygwin-git, or JGit/EGit will result in completely broken file names. The \nquasi-standard file name encoding in git repositories is UTF-8.\n\n> There is nothing said in the manual, that core.quotepath affects \n> only header. But it is not the point. You don't know which part of \n> git output will be consumed by machine. Warning message is addressed\n> to human, but it can be consumed by program in the same way as all \n> other messages and output data.\n\nError / warning messages may be localized, so they are particularly \nunsuitable for consumption by other programs. That's why many git commands \nhave special switches to make their output machine readable (e.g. -z). \nIncidentally, 'git-log -z' also disables core.quotepath. So if you write a \nprogram that parses git output, and you're using the proper 'machine \nreadable' version, you should never have to worry about quoted paths, \nirrespective of the core.quotepath setting.\n\n> Imho, since warning comes from git, path should be quoted to\n> make git behaviour consistent. \n> From git-log help:\n> > Note that we deliberately chose not to re-code the commit log \n> message when a commit is made to force UTF-8 at the commit object \n> level, because re-coding to UTF-8 is not necessarily a reversible \noperation.\n> \n> If re-coding from one encoding to other is not necessarily a \n> reversible operation, and you can set logoutputencoding to any \n> encoding you wish, you may loose some charatcers while recoding file\n> path in warning message. Quoting it would be desired then.\n> \n\nThe i18n.commitencoding and i18n.logoutputencoding settings only affect \ncommit log messages. They are completely unrelated to error / warning \nmessages, file names, or file name quoting.\n\nHope that helps,\nKarsten\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"},{"id":"196600","messageId":"3bc6610e.6355e5e2.5020cfc7.c1687@o2.pl","threadId":"31185","inReplyTo":"OF9C260C14.7F8DC09D-ONC1257A52.005D3AD5-C1257A52.005F222E@dcon.de","subject":"Re: Re: Re: Re: File path not escaped in warning message","fromName":"jbialobr","fromEmail":"jbialobr@o2.pl","sentAt":"2012-08-07T08:20:23Z","receivedAt":"2012-08-07T08:20:23Z","isPatch":false,"sender":{"key":"jbialobr@o2.pl","avatar":"https://gravatar.com/avatar/582fa36441bf789976d4b7bbf3a79635270c4c7349db3eaac2142657f1ea85e5?d=mp&s=160"},"body":"Hi Karsten,\n\nThanks, you helped me a lot. I see now, that logoutputencoding \nis for commit header data, not for whole log output. The name\nis little missleading, so do description:\ni18n.logOutputEncoding\n   Encoding to use when displaying logs.\n\nRegarding git-log / git-diff output, there are basically three different\n\ncharacter set encodings involved:\n1. commit log messages: re-coded to i18n.logoutputencoding (usually\nUTF-8)\n\nalso commiter and author fields.\n\n2. file content: printed verbatim (no re-coding); gui tools such as gitk\n\nmay decode this based on gui.encoding or .gitattributes settings\n3. everything else (file names, diff headers, error / warning messages):\n\nalways UTF-8 (at least in Git for Windows)\n\nIt is more like git encoding than UTF-8. \n\n\nGui tools such as gitk decode this output line by line using the \nappropriate encoding.\n\nIt would be easier to do it if output was displayed in consistent way. I\nsee no reason why one part of output is quoted and other is not. Another\nexample:\n\n$ git status\nwarning: LF will be replaced by CRLF in 1ą.txt.\nThe file will have its original line endings in your working directory.\n# On branch master\n# Your branch and 'origin/master' have diverged,\n# and have 2 and 2 different commit(s) each, respectively.\n#\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       modified:   \"1\\261.txt\"\n#\n\nGit doesn't recode commit header when --pretty is set to format,\nbut recodes when --pretty is set to full, raw, etc. Do you know if it is\ndone by mistake or by design?\n\nThanks again,\nJanusz Białobrzewski.\n\n\n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n"}]}