diff options
Diffstat (limited to 'lib/gall/tree.lua')
-rw-r--r-- | lib/gall/tree.lua | 9 |
1 files changed, 5 insertions, 4 deletions
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 |