Alexey Nezhdanov <[EMAIL PROTECTED]> writes:

> But this should not be user's problem - it's just the UI that doesn't 
> understands when transcoding should be done.

I disagree.

Yes, while you _could_ do something like this to feed text in
local encoding to the VISUAL/EDITOR, and convert it back to
UTF-8:

--- a/git-commit-script
+++ b/git-commit-script
@@ -84,7 +84,7 @@
 fi
 if [ "$?" != "0" ]
 then
-       cat .editmsg
+       git-char-conv --utf8-to-user < .editmsg
        rm .editmsg
        exit 1
 fi
@@ -93,7 +93,9 @@
        ${VISUAL:-${EDITOR:-vi}} .editmsg
        ;;
 esac
-grep -v '^#' < .editmsg | git-stripspace > .cmitmsg
+grep -v '^#' < .editmsg |
+git-stripspace |
+git-char-conv --user-to-utf8 > .cmitmsg
 [ -s .cmitmsg ] && 
        tree=$(git-write-tree) &&
        commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&


I think it is a horrible way to do things.

I presume that your bringing up UTF-8 suggests that you believe
doing things in UTF-8 for interoperability's sake is the right
thing.  If that is indeed the case, then tools other than GIT
and Cogito you would use would need to deal with this exact same
problem, that your VISUAL/EDITOR does not understand UTF-8.

How about writing a little wrapper, koi-vi, which would roughly
be:

    #!/bin/sh
    tcs -f utf -t koi8 "$1" >.tmp-koi
    vi .tmp-koi
    tcs -t utf -f koi8 .tmp-koi >"$1"

and point VISUAL/EDITOR environment variable at it?  That way
your other tools would be able to let you keep using your
favorite editor, now utf8 enabled, and deal with UTF-8.  None of
the scripts, including the script I quoted above, has to be
changed that way.

Having said that, I personally feel that the choice of the
character encoding of commit messages is per-project convention
issue and does not even warrant a per-project "configuration
file".  As long as your developers all agree to use KOI, and you
are reasonably sure that you will not ever cross-merge with
another project that uses different encoding for commit
messages, I think it is perfectly fine to use KOI in your commit
messages.  The core's job is only to ensure that we are 8-bit
clean and faithfully record whatever you throw at us.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to