Commit 9683cf60 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

HgGitRepository: don't crash if no managed hgrc exists yet

Closes #299

We'll return content to be `nil` in that case, which will be
conveyed as `null` in the JSON API.

--HG--
branch : heptapod-stable
parent 2d5d3aff9555
......@@ -1100,9 +1100,11 @@ def set_hgrc(user, inherit, namespace_path, values)
def get_hgrc
main_lines = File.readlines(hgrc_main_path)
main_stripped_lines = main_lines.map { |l| l.strip }
managed_path = hgrc_managed[1]
content = File.exist?(managed_path) ? File.read(managed_path) : nil
{
'inherit' => !match_idx(main_stripped_lines, HGRC_INCL_INHERIT_RX).nil?,
'content' => File.read(hgrc_managed[1])
'content' => content,
}
end
......
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