From 8a2f7a455baa7dc722434220a25fe0752e23f6f7 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 22 Nov 2010 16:19:02 -0500 Subject: [PATCH] Fixed an error when trying to show the initial commit diff --- browser/vcs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/browser/vcs.py b/browser/vcs.py index 9a879a6..3acb462 100644 --- a/browser/vcs.py +++ b/browser/vcs.py @@ -166,7 +166,12 @@ class Git(VCS): a = b.parents[:1] else: a = self._repo.commit(a) - for diff in b.diff(a): + if a: + diffs = b.diff(a) + else: + # No parents, use the default behaviour (safe for bare repos) + diffs = b.diff() + for diff in diffs: # b and a are swapped so the parent diff will work as a list of # parents. Therefore, we'll swap them back when we put them into our # Diff object.