2012年6月24日日曜日

Cygwin上のgit statusで文字化け

何度やっても忘れて調べてしまうので、覚書として書いておきます。

Cygwinは1.7.xからはUTF-8の環境となっているため、gitを使って日本語を扱う場合でもあまり困らない状況にはなっています。ところがlsなどでは
日本語ファイル名がちゃんと表示されるのにgit statusを実行するたと表示される日本語ファイル名が文字化けしてこまる場合があります。その時には
git config --global core.quotepath false

を実行します。core.quotepathって何ということでhelpを見てみると

The commands that output paths (e.g. ls-files, diff), when not given the -z option, will quote "unusual" characters in the pathname by enclosing the pathname in a double-quote pair and with backslashes the same way strings in C source code are quoted. If this variable is set to false, the bytes higher than 0x80 are not quoted but output as verbatim. Note that double quote, backslash and control characters are always quoted without -z regardless of the setting of this variable.

という事で、ひとことで言うと余計な事をするな!という設定をしている事になります。




0 件のコメント:

コメントを投稿