Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode in Git alias

Tags:

git

unicode

I am working on a project involving both English and Hebrew in Git (2.4.5 on Cygwin). I haven't encountered any problems with using Hebrew in a Git repository.

Because I switch back and forth between Hebrew and English often, I put aliases in my bashrc for common commands, so that it works if I try to type them when my setting is Hebrew. For example

alias עןא=git

(עןא is not a translation or transliteration of Git; it's not a word at all. It's just what you get when you try to type "git", but your keyboard is set to Hebrew).

When I try to take the next step, however, I get problems. I add aliases to my Git config:

  [alias]
    דאשאוד=status

and then try to run:

$ עןא דאשאוד
  fatal: bad config file line 18 in /home/Heshy/.gitconfig

(yes, דאשאוד=status is line 18)

Is there any way to get a Git alias to accept Hebrew letters (either through .gitconfig or another way)?

like image 888
Heshy Avatar asked Jul 04 '26 10:07

Heshy


1 Answers

I found an answer to my own question, but it's ugly. Better answers are still appreciated.

echo 'git status "$@"' > /bin/git-דאשאוד
chmod u+x /bin/git-דאשאוד

It works... but with an error message that I don't understand.

$ git דאשאוד
error: invalid key: pager.דאשאוד
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        testfile

nothing added to commit but untracked files present (use "git add" to track)

The error message doesn't happen if I call the file git-someenglishname instead.

I also tried some manipulation to grep out the error message. The problem is that if I put this in /bin/git-דאשאוד, the message is still there. I assume this is because the error message is produced by the call to git itself, outside of the call to git-דאשאוד.

I guess a full solution would be to create a wrapper script for git itself (or maybe just for עןא) that removes those error messages. This is even uglier. As I said, a better answer would still be very welcome.

like image 121
Heshy Avatar answered Jul 07 '26 00:07

Heshy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!