From c5bab37dca177e9b2d41bb1fa315a5efd7129281 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 12 Jan 2017 15:24:39 +0100 Subject: [PATCH] Make sure all working_copy_available() functions return an error on false Behaves more like other functions, reduce potential for bugs in error path Signed-off-by: Tobias Ulmer --- plugins/cvs.lua | 5 ++++- plugins/files.lua | 2 +- plugins/svn.lua | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/cvs.lua b/plugins/cvs.lua index 0d5a732..ab2651e 100644 --- a/plugins/cvs.lua +++ b/plugins/cvs.lua @@ -403,7 +403,10 @@ end function cvs.working_copy_available(info, sourcename) local src = source.sources[sourcename] local dir = e2lib.join(info.root, src:get_working()) - return e2lib.isdir(dir) + if not e2lib.isdir(dir) then + return false, err.new("working copy for %s is not available", sourcename) + end + return true end function cvs.has_working_copy(info, sourcename) diff --git a/plugins/files.lua b/plugins/files.lua index 39b454b..651dcd7 100644 --- a/plugins/files.lua +++ b/plugins/files.lua @@ -313,7 +313,7 @@ function files.fetch_source(info, sourcename) end function files.working_copy_available(info, sourcename) - return false + return false, err.new("source %s doesn't require a working copy", sourcename) end function files.has_working_copy(info, sourcename) diff --git a/plugins/svn.lua b/plugins/svn.lua index 23d4c2b..eafe469 100644 --- a/plugins/svn.lua +++ b/plugins/svn.lua @@ -421,7 +421,10 @@ function svn.working_copy_available(info, sourcename) local src = source.sources[sourcename] local dir = e2lib.join(info.root, src:get_working()) - return e2lib.isdir(dir) + if not e2lib.isdir(dir) then + return false, err.new("working copy for %s is not available", sourcename) + end + return true end function svn.check_workingcopy(info, sourcename) -- 2.39.5