git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Last mile to 1.0?

From
Junio C Hamano <junkio@cox.net>
Date
Jul 18, 2005, 07:38 UTC
Message-ID
<7vr7dw36nz.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200507181048.50303.snake@penza-gsm.ru>
Alexey Nezhdanov <snake@penza-gsm.ru> 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.
Previous: Alexey NezhdanovNext: Ryan Anderson
Message 9 of 19 in “Last mile to 1.0?”
  1. Junio C HamanoJul 16, 2005
  2. Eric W. BiedermanJul 16, 2005
  3. Junio C HamanoJul 17, 2005
  4. David LangJul 17, 2005
  5. Junio C HamanoJul 18, 2005
  6. Alexey NezhdanovJul 18, 2005
  7. Junio C HamanoJul 18, 2005
  8. Alexey NezhdanovJul 18, 2005
  9. Junio C HamanoJul 18, 2005
  10. Ryan AndersonJul 23, 2005
  11. Gene HeskettJul 23, 2005
  12. 0/6 A bit better dumb server supportJunio C Hamano, Jul 24, 2005
  13. Ryan AndersonJul 23, 2005
  14. Gene HeskettJul 23, 2005
  15. Kevin SmithJul 23, 2005
  16. Junio C HamanoJul 23, 2005
  17. Alexey NezhdanovJul 24, 2005
  18. Petr BaudisJul 29, 2005
  19. Junio C HamanoJul 30, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.