summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activity/formats/svg.lua2
-rw-r--r--activity/git.lua10
-rwxr-xr-xgenerate.lua6
3 files changed, 12 insertions, 6 deletions
diff --git a/activity/formats/svg.lua b/activity/formats/svg.lua
index f7e2700..cbbb35d 100644
--- a/activity/formats/svg.lua
+++ b/activity/formats/svg.lua
@@ -35,7 +35,7 @@ local row_offset = 0 -- Format(s) should be stateful and instantiable.
function svg.start_table ()
row_offset = 0
- return [[]] .. "\n"
+ return ""
end
diff --git a/activity/git.lua b/activity/git.lua
index 160d227..b24fc09 100644
--- a/activity/git.lua
+++ b/activity/git.lua
@@ -18,17 +18,19 @@ function git.log (dirname, entries, filter)
end
local ok, _ = handle:close()
if not ok then
- error "git log closed unexpectedly"
+ io.stderr:write("could not read repo: ", dirname, "\n")
end
- return entries
+ return not ok, entries
end
function git.lookup (repositories, filter)
local lookup = {}
+ local errors = nil
local entries = {}
for _, dirname in pairs(repositories) do
- git.log(dirname, entries, filter)
+ local err, _ = git.log(dirname, entries, filter)
+ errors = errors or err
end
for _, entry in pairs(entries) do
local day = dates.day_of_year(entry.date)
@@ -36,7 +38,7 @@ function git.lookup (repositories, filter)
lookup[year] = lookup[year] or {}
lookup[year][day] = (lookup[year][day] or 0) + 1
end
- return function (year, day)
+ return errors, function (year, day)
return (lookup[year] or {})[day] or 0
end
end
diff --git a/generate.lua b/generate.lua
index bc46585..4b0728f 100755
--- a/generate.lua
+++ b/generate.lua
@@ -33,4 +33,8 @@ if by_committer and by_author then
end
end
filter = filter or by_author or by_committer
-io.write(generators.generate_table(maybe_year, git.lookup(args.repos, filter), maybe_format))
+local errors, lookup = git.lookup(args.repos, filter)
+io.write(generators.generate_table(maybe_year, lookup, maybe_format))
+if errors then
+ os.exit(1)
+end