Modify

Opened 6 years ago

Closed 21 months ago

#8639 closed defect (wontfix)

PyGIT._get_branches fails with ValueError on commit messages with line feeds

Reported by: Carsten Klein Owned by: Herbert Valerio Riedel
Priority: normal Component: GitPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

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

    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").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

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 21 months ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

GitPlugin is deprecated. Please upgrade to Trac 1.0 and use TracGit.

Modify Ticket

Action
as closed The owner will remain Herbert Valerio Riedel.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.