From 095ccc5c927389eb6915caa17853d7bba90eb6b1 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 20 Jan 2019 23:01:11 +0100 Subject: Don't crash with commit messages that aren't valid utf-8 --- git_deps/gitutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git_deps') diff --git a/git_deps/gitutils.py b/git_deps/gitutils.py index f699551..47355d2 100644 --- a/git_deps/gitutils.py +++ b/git_deps/gitutils.py @@ -55,7 +55,11 @@ class GitUtils(object): @classmethod def oneline(cls, commit): - return commit.message.split('\n', 1)[0] + try: + ret = commit.message.split('\n', 1)[0] + except UnicodeDecodeError: + ret = "Invalid utf-8 commit message" + return ret @classmethod def commit_summary(cls, commit): -- cgit