From b80edbf10b277115c97a28354a88da97f74d0767 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 8 Sep 2012 17:32:03 +0100 Subject: GALL.TREE: Test trees as much as possible --- lib/gall/tree.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/gall/tree.lua') diff --git a/lib/gall/tree.lua b/lib/gall/tree.lua index ed7ba4b..43f76f1 100644 --- a/lib/gall/tree.lua +++ b/lib/gall/tree.lua @@ -44,10 +44,11 @@ end function tree_method:diff_to(other) -- Generate a diff from self to other local repo = repos[self] - local ok, streediff = repo:rawgather("diff-tree", "-r", "-M", "-C", - objs[self].sha, objs[other].sha) + local ok, streediff, err = repo:rawgather("diff-tree", "-r", "-M", "-C", + ((objs[self] or {}).sha) or "???", + ((objs[other] or {}).sha) or "???") if ok ~= 0 then - return nil, streediff + return nil, (streediff or "") .. "\n" .. (err or "") end local treediff = {} for startmode, endmode, startsha, endsha, action, score, filenames in @@ -176,7 +177,7 @@ local function _create(repo, flat_tree) for k, v in pairs(t) do if k ~= "" then local ok, obj = pcall(function() return v.obj end) - if ok then + if ok and obj then v = obj end if not mode[v.type] then -- cgit v1.2.1