Binary data in extras field of Hg commit causes HTTP 500 errors with Hg encoding set to utf-8

Issue #947 resolved
Gábor Stefanik
created an issue

changesets-eager.style includes the following: {join(extras,',')}

Per https://bz.mercurial-scm.org/show_bug.cgi?id=5504, extras is considered binary data that should not in general be decoded as text. Notably, hg-git stores binary data in this field, so for commits converted from git using hg-git, {join(extras,',')} will contain e.g. non-UTF-8-decodable data even with HGENCODING=="utf-8".

As a result, when the Encoding setting in Repository Config is set to UTF-8 or any other structured encoding, commits created by hg-git will throw HTTP 500 errors as SCM Manager tries to decode the extras field as strict UTF-8.

Since we only use the extras field to detect commits that close a branch, a possible fix is to replace "{join(extras,',')}" with "close={if(get(extras, 'close'),1,0)}", which is guaranteed to be correctly encoded.

Comments (1)

  1. Log in to comment