#10598 closed defect (fixed)
GitPlugin: PyGIT._get_branches fails with ValueError on commit messages with line feeds — at Version 3
Reported by: | Peter Suter | Owned by: | Jun Omae |
---|---|---|---|
Priority: | lowest | Milestone: | 1.0.2 |
Component: | plugin/git | Version: | |
Severity: | normal | Keywords: | |
Cc: | Ryan J Ollos | Branch: | |
Release Notes: |
fix |
||
API Changes: | |||
Internal Changes: |
Description
Created as part of the move of GitPlugin. Tickets originally reported for th:GitPlugin: th:#8639
Quoting Carsten Klein:
I have a commit here that includes a subject line that includes ^M characters. This will cause get_branches to fail when trying to unpack the malformed lines resulting from splitting on linefeed boundary.
Here is a proposed fast solution that will replace all ^M characters so that retrieving the branch information does not fail
--- /trunk/tracopt/versioncontrol/git/PyGIT.py +++ /trunk/tracopt/versioncontrol/git/PyGIT.py def _get_branches(self): "returns list of (local) branches, with active (= HEAD) one being the first item" result = [] - for e in self.repo.branch("-v", "--no-abbrev").splitlines(): + for e in self.repo.branch("-v", "--no-abbrev").replace('\r', '/CTRL-R').splitlines(): bname, bsha = e[1:].strip().split()[:2] if e.startswith('*'): result.insert(0, (bname, bsha)) else: result.append((bname, bsha)) return result
Change History (3)
comment:1 by , 11 years ago
Milestone: | → next-stable-1.0.x |
---|---|
Priority: | normal → lowest |
comment:2 by , 11 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
Reproduced with CR
s in the center of commit log. In [cac08aede/jomae.git], added the fix and unit tests.
comment:3 by , 11 years ago
Milestone: | next-stable-1.0.x → 1.0.2 |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in [11802].
Link to a git repos demonstrating the issue welcome.