threads / discuss / 34533

git and cyrillic branches

Subject: git and cyrillic branches

## tl;dr

9 messages between Jul 25, 2013 and Jul 26, 2013.

replies: 8people: 5as markdown or json

иванов иван· Jul 25, 2013, 12:19 UTC · lore
hello! there is problem vith git and cyrillic (utf-8) names of branches. branch creates perfectly, but when i clone this remote branch to local host, there are 2 bugs:
1) "git branch" doesnt show checked branch with asterisk (while on remote server it does)
2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be resolved to branch." and "fatal: The remote end hung up unexpectedly"
thanks.
Konstantin Khomoutov· Jul 25, 2013, 12:45 UTC · re: иванов иван · lore

Re: git and cyrillic branches

On Thu, 25 Jul 2013 15:19:48 +0300 иванов иван <xowirun@yandex.ru> wrote:

Show 7 quoted lines
> hello! there is problem vith git and cyrillic (utf-8) names of
> branches. branch creates perfectly, but when i clone this remote
> branch to local host, there are 2 bugs:
> 1) "git branch" doesnt show checked branch with asterisk (while on
> remote server it does)
> 2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be resolved
> to branch." and "fatal: The remote end hung up unexpectedly" thanks.

Works for me across two Debian systems: both have Git 1.7.10.4; user accounts on both systems have LANG=en_US.UTF-8 configured in their environment.

Do both of your systems (local and remote) have an UTF-8-enabled (or encoding-agnostic, like "C") locale active?

Torsten Bögershausen· Jul 26, 2013, 01:50 UTC · re: иванов иван · lore

Re: git and cyrillic branches

On 2013-07-25 14.19, иванов иван wrote:
> hello! there is problem vith git and cyrillic (utf-8) names of branches. branch creates perfectly, but when i clone this remote branch to local host, there are 2 bugs:
> 1) "git branch" doesnt show checked branch with asterisk (while on remote server it does)
> 2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be resolved to branch." and "fatal: The remote end hung up unexpectedly"
> thanks.

It could be helpful if you could provide more information. The best could be a step-by-step instruction using a some "mini repo", so that we we can reproduce the problem. I have done an illustrating example using UTF-8, (not cyrillic, I don't have these letters on my keyboard ;-)

tb@linux:~$ mkdir cyrill
tb@linux:~$ cd cyrill/
tb@linux:~/cyrill$ git init
Initialized empty Git repository in /home/tb/cyrill/.git/
tb@linux:~/cyrill$ echo File>File
tb@linux:~/cyrill$ git checkout -b bränch
Switched to a new branch 'bränch'
tb@linux:~/cyrill$ git add File
tb@linux:~/cyrill$ git commit -m "Add File"
[bränch (root-commit) e39d84e] Add File
 1 file changed, 1 insertion(+)
 create mode 100644 "File"
tb@linux:~/cyrill$ git branch
* bränch
tb@linux:~/cyrill$ 
tb@macos:~> git clone tb@linux:~/cyrill
Cloning into 'cyrill'...
tb@linux's password: 
remote: Counting objects: 3, done.
Receiving objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
tb@macos:~> cd cyrill/
tb@macos:~/cyrill> git branch
* bränch
tb@macos:~/cyrill> ls -l
total 8
-rw-r--r--  1 tb  staff  6 Jul 26 03:39 File
tb@macos:~/cyrill> 

=================== Other question: what does (on Mac OS) git config core.precomposeunicode give you? /Torsten

ксовиран· Jul 26, 2013, 07:35 UTC · re: Torsten Bögershausen · lore

Re: git and cyrillic branches

26.07.2013, 05:50, "Torsten Bögershausen" <tboegi@web.de>:
Show 49 quoted lines
> On 2013-07-25 14.19, иванов иван wrote:
>
>>  hello! there is problem vith git and cyrillic (utf-8) names of branches. branch creates perfectly, but when i clone this remote branch to local host, there are 2 bugs:
>>  1) "git branch" doesnt show checked branch with asterisk (while on remote server it does)
>>  2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be resolved to branch." and "fatal: The remote end hung up unexpectedly"
>>  thanks.
>
> It could be helpful if you could provide more information.
> The best could be a step-by-step instruction using a some "mini repo",
> so that we we can reproduce the problem.
> I have done an illustrating example using UTF-8,
> (not cyrillic, I don't have these letters on my keyboard ;-)
>
> tb@linux:~$ mkdir cyrill
> tb@linux:~$ cd cyrill/
> tb@linux:~/cyrill$ git init
> Initialized empty Git repository in /home/tb/cyrill/.git/
> tb@linux:~/cyrill$ echo File>File
> tb@linux:~/cyrill$ git checkout -b bränch
> Switched to a new branch 'bränch'
> tb@linux:~/cyrill$ git add File
> tb@linux:~/cyrill$ git commit -m "Add File"
> [bränch (root-commit) e39d84e] Add File
>  1 file changed, 1 insertion(+)
>  create mode 100644 "File"
> tb@linux:~/cyrill$ git branch
> * bränch
> tb@linux:~/cyrill$
>
> tb@macos:~> git clone tb@linux:~/cyrill
> Cloning into 'cyrill'...
> tb@linux's password:
> remote: Counting objects: 3, done.
> Receiving objects: 100% (3/3), done.
> remote: Total 3 (delta 0), reused 0 (delta 0)
> tb@macos:~> cd cyrill/
> tb@macos:~/cyrill> git branch
> * bränch
> tb@macos:~/cyrill> ls -l
> total 8
> -rw-r--r--  1 tb  staff  6 Jul 26 03:39 File
> tb@macos:~/cyrill>
>
> ===================
> Other question:
> what does (on Mac OS)
> git config core.precomposeunicode
> give you?
> /Torsten

okay, i've changed core.precomposeunicode to true and seems it solved the problem, branches are listed just fine and git push goes good as well. i didn't look that way at first time, thought that is case for filenames only, not branches. thank you all for responces, i guess this time problem is really solved now. :)

Konstantin Khomoutov· Jul 25, 2013, 14:28 UTC · lore

Re: git and cyrillic branches

On Thu, 25 Jul 2013 17:06:41 +0400 ксовиран <xowirun@yandex.ru> wrote:

Show 19 quoted lines
> >>  hello! there is problem vith git and cyrillic (utf-8) names of
> >>  branches. branch creates perfectly, but when i clone this remote
> >>  branch to local host, there are 2 bugs:
> >>  1) "git branch" doesnt show checked branch with asterisk (while on
> >>  remote server it does)
> >>  2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be
> >> resolved to branch." and "fatal: The remote end hung up
> >> unexpectedly" thanks.
> >
> > Works for me across two Debian systems: both have Git 1.7.10.4; user
> > accounts on both systems have LANG=en_US.UTF-8 configured in their
> > environment.
> >
> > Do both of your systems (local and remote) have an UTF-8-enabled (or
> > encoding-agnostic, like "C") locale active?
>
> oh, yes indeed. i was pushing from mac to ubuntu, but ubuntu to
> ubuntu works fine. although #locale gives almost identical output, so
> it is something to work out. спасибо за помощь! 25.07.2013, 16:45,

I'm afraid, this might be not that simple: Git received certain tweaks to work around certain problems Mac OS X has (as I understand it) with handling UTF-8 on various filesystems it supports; in particular, see commits 76759c7dff53e8c84e975b88cb8245587c14c7ba [1] and b856ad623e4f686815986c0b9341dd1bfd791e71 [2] which were released as part of v1.7.12.

So... I'm not sure, but I beleive these fixes might have been related to handling filenames in the work tree and the index only, not branches, as having branches with non-ASCII names is a weird idea to most developers, I think. So the question is: do you have Git >= 1.7.12 on your Mac OS X machine? If so, do you still experience this problem (I think that Macs do not have non-UTF-8 locales anyway, so this is unlikely the root cause).

P.S. Please don't top-post as this breaks discussion flow and hence sucks.

1. https://github.com/git/git/commit/76759c7
2. https://github.com/git/git/commit/b856ad6
ксовиран· Jul 25, 2013, 14:51 UTC · re: Konstantin Khomoutov · lore

Re: git and cyrillic branches

25.07.2013, 18:28, "Konstantin Khomoutov" <kostix+git@007spb.ru>:
Show 41 quoted lines
> On Thu, 25 Jul 2013 17:06:41 +0400
> ксовиран <xowirun@yandex.ru> wrote:
>
>>>>   hello! there is problem vith git and cyrillic (utf-8) names of
>>>>   branches. branch creates perfectly, but when i clone this remote
>>>>   branch to local host, there are 2 bugs:
>>>>   1) "git branch" doesnt show checked branch with asterisk (while on
>>>>   remote server it does)
>>>>   2) "git push" gives 2 errors: "fatal: BRANCH_NAME cannot be
>>>>  resolved to branch." and "fatal: The remote end hung up
>>>>  unexpectedly" thanks.
>>>  Works for me across two Debian systems: both have Git 1.7.10.4; user
>>>  accounts on both systems have LANG=en_US.UTF-8 configured in their
>>>  environment.
>>>
>>>  Do both of your systems (local and remote) have an UTF-8-enabled (or
>>>  encoding-agnostic, like "C") locale active?
>>  oh, yes indeed. i was pushing from mac to ubuntu, but ubuntu to
>>  ubuntu works fine. although #locale gives almost identical output, so
>>  it is something to work out. спасибо за помощь! 25.07.2013, 16:45,
>
> I'm afraid, this might be not that simple: Git received certain tweaks
> to work around certain problems Mac OS X has (as I understand it) with
> handling UTF-8 on various filesystems it supports; in particular, see
> commits 76759c7dff53e8c84e975b88cb8245587c14c7ba [1]
> and b856ad623e4f686815986c0b9341dd1bfd791e71 [2] which were released as
> part of v1.7.12.
>
> So... I'm not sure, but I beleive these fixes might have been related to
> handling filenames in the work tree and the index only, not branches, as
> having branches with non-ASCII names is a weird idea to most
> developers, I think.  So the question is: do you have Git >= 1.7.12 on
> your Mac OS X machine?  If so, do you still experience this problem (I
> think that Macs do not have non-UTF-8 locales anyway, so this is
> unlikely the root cause).
>
> P.S.
> Please don't top-post as this breaks discussion flow and hence sucks.
>
> 1. https://github.com/git/git/commit/76759c7
> 2. https://github.com/git/git/commit/b856ad6

there is nothing wrong with having branches with non-ASCII names as english is not the only language in the world. problem is still here, i've got ubuntu on VM and same shared git-folder causes this problem on Mac Os and no problems on Ubuntu. git version on Mac is 1.8.0.1 (on Ubuntu is 1.7.10.4)

Martin Langhoff· Jul 25, 2013, 15:26 UTC · re: ксовиран · lore

Re: git and cyrillic branches

On Thu, Jul 25, 2013 at 10:51 AM, ксовиран <xowirun@yandex.ru> wrote:
> problem is still here, i've got ubuntu on VM and same shared git-folder causes this problem on Mac Os and no problems on Ubuntu.
> git version on Mac is 1.8.0.1 (on Ubuntu is 1.7.10.4)

OSX filesystem code canonicalizes UTF-8 filenames in a way that disagrees with GIT's design (and Linux's fs design) which considers a filename to be a bag of bytes better left alone.

So the ugly fixes applied to filenames need to be applied too to refs, I guess.

Are you using packed refs? That's probably a good workaround in the meantime. Using packed refs, git will not need to store the branchname as a filename...

cheers,
m
--
 martin.langhoff@gmail.com
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
Konstantin Khomoutov· Jul 25, 2013, 15:34 UTC · re: ксовиран · lore

Re: git and cyrillic branches

On Thu, 25 Jul 2013 18:51:57 +0400 ксовиран <xowirun@yandex.ru> wrote:

[...]
> > I'm afraid, this might be not that simple: Git received certain
> > tweaks to work around certain problems Mac OS X has (as I
> > understand it) with handling UTF-8 on various filesystems it
> > supports; in particular, see commits
[...]
> > So... I'm not sure, but I beleive these fixes might have been
> > related to handling filenames in the work tree and the index only,
> > not branches, as having branches with non-ASCII names is a weird
> > idea to most developers, I think.
[...]
> there is nothing wrong with having branches with non-ASCII names as
> english is not the only language in the world.

Well, this my remark was just to explain why the problem with branches which *are* files (well, unless they have become "packed refs") in the reference Git implementation, might had good chances to escape the scope of the tweaks being discussed. Of course, there's nothing wrong with non-ASCII branch names unless this impedes collaboration on a project which uses them.

> problem is still here, i've got ubuntu on VM and same shared
> git-folder causes this problem on Mac Os and no problems on Ubuntu.
> git version on Mac is 1.8.0.1 (on Ubuntu is 1.7.10.4)
I hope someone possessing the necessary knowledge will look at it.
Konstantin Khomoutov· Jul 25, 2013, 16:07 UTC · re: ксовиран · lore

Re: git and cyrillic branches

On Thu, 25 Jul 2013 18:51:57 +0400 ксовиран <xowirun@yandex.ru> wrote:

[...]
Show 7 quoted lines
> > I'm afraid, this might be not that simple: Git received certain
> > tweaks to work around certain problems Mac OS X has (as I
> > understand it) with handling UTF-8 on various filesystems it
> > supports; in particular, see commits
> > 76759c7dff53e8c84e975b88cb8245587c14c7ba [1] and
> > b856ad623e4f686815986c0b9341dd1bfd791e71 [2] which were released as
> > part of v1.7.12.
[...]

And while we're at it, commit message of 76759c7 tells that in order for the fixes to work, the core.precomposedunicode configuration variable has to be set to 'true'. Did you do that? Did that help?

← back to recent threads