Commit 570c9b67 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

HgGitRepository: make get_hg_heptapod_config work if empty

Because `hg config SECTION` exits with code 1 if no matching
setting have been found, we previously had an error if this
method (and the corresponding API endpoint) was called before
any local setting is set in the `[heptapod]` section.

This can be considered part of #299, too

Also fixed the exception raising, Ruby has its quirks, not the
same as Python's.

branch : heptapod-stable
parent c23adf095138
......@@ -1167,7 +1167,9 @@ def get_hg_heptapod_config
hg_exe = Gitlab.config.mercurial.bin_path
out, status = popen([hg_exe, 'config', 'heptapod'],
@hgpath, hg_env)
raise StandardError("Can't read hg repository config") unless
return {} if status == 1 # as usual, code 1 is not an error for hg
raise StandardError, "Can't read hg repository config" unless
config = {}
out.lines.each do |line|
key, value = line.split('=', 2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment