Global config cannot be set if ~/.gitconfig does not exist yet
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
When there is no ~/.gitconfig, the following code snippet
import pygit2
global_config = pygit2.Config.get_global_config() # ← Exception raised here
global_config['user.email'] = 'me@example.org'
fails with
Traceback (most recent call last):
File "global_config.py", line 2, in <module>
global_config = pygit2.Config.get_global_config()
File "/usr/lib/python3/dist-packages/pygit2/config.py", line 281, in get_global_config
return Config._from_found_config(C.git_config_find_global)
File "/usr/lib/python3/dist-packages/pygit2/config.py", line 265, in _from_found_config
check_error(err, True)
File "/usr/lib/python3/dist-packages/pygit2/errors.py", line 53, in check_error
raise IOError(message)
OSError: the global file '.gitconfig' doesn't exist: No such file or directory
I.e.,
- there seems to be no way of setting a global option unless
~/.gitconfigalready exists. - There seems to be no way to create the global config file ahead of time, at least not in a portable way (I doubt it is in
~/.gitconfigon Windows systems).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、~/.gitconfig がない状態で提供された Python スニペットを再現し、その後 pygit2/config.py、特に Config.get_global_config と _from_found_config を調べます。グローバル設定ファイルが存在しなくてもグローバルオプションを設定でき、かつその場所が異なるプラットフォームでも設定できれば、修正は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- git, python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 58/100