When I tried to create new repository using op/new-repository, I got Fatal: failed to initialize new git repository… error.
When I looked at the source code, I noticed that op/git-init-repo checks for the string Initialized empty Git repository in the command's output. In my case (ru_RU.UTF-8 locale) git init returns the following message when succeeds (in Russian): Инициализирован пустой репозиторий Git в $dirname.
So even if the command finished successfully and an empty repository was created, op/git-init-repo considered it failing, which aborted the execution of op/new-repository . op/git-init-repo is not the only function which is broken on my system, op/git-new-branch won't work as well.
Checking command output is not very reliable way to tell if an error occured. First, it won't work on systems where git messages are localized. Second, the messages may change in future.
I suggest one of the following ways to the issue:
check the exit code instead of parsing the output to determine if something wrong has happened;
use an existing library which exposes git API (e.g, git.el).
When I tried to create new repository using
op/new-repository
, I gotFatal: failed to initialize new git repository…
error.When I looked at the source code, I noticed that
op/git-init-repo
checks for the stringInitialized empty Git repository
in the command's output. In my case (ru_RU.UTF-8
locale)git init
returns the following message when succeeds (in Russian):Инициализирован пустой репозиторий Git в $dirname
.So even if the command finished successfully and an empty repository was created,
op/git-init-repo
considered it failing, which aborted the execution ofop/new-repository
.op/git-init-repo
is not the only function which is broken on my system,op/git-new-branch
won't work as well.Checking command output is not very reliable way to tell if an error occured. First, it won't work on systems where git messages are localized. Second, the messages may change in future.
I suggest one of the following ways to the issue: